SSRS Traverse Folders & Download RDL Files

07 Mar
March 7, 2012

A few times in the past I ran into a situation with SQL Server’s SSRS, were I needed to download all the RDL files off the server, while also maintaining the folder hierarchy information.

There are many off-the-shelf scripts out-there online to help you download all your RDL files (along with security settings and other configuration files), this article goes through a couple of simple methods that can be used to retrieve the RDLs.

There are two ways to accomplish traversing the SSRS folder & RDL hierarchy:

Downloading SSRS RDL Files using SSRS Web Service SOAP Methods

This is abit more standard, the methods are well defined, you can traverse the full SSRS hierarchy, download reports, and do a lot more (such as interrogate report schedules, execution history, etc.). The method GetReportDefinition can be used to download the reports, while the ListChildren method can be used to traverse the SSRS folder structure (hierarchy).

The nice thing about this approach is the extended functionality it opens, which allows deeper levels of integration between the two systems you are trying to establish communication between.

Using the SSRS Web Service in a REST-ful Way

Basically when you hit the root URL of the SSRS Web Service using REST, it will return an HTML representation of the folder structure, which can be traversed (through following HTML links). In order to download the RDL, we need to slightly “hack” the URL with the correct REST parameters:
a. To traverse the SSRS Web Service root URL, you can go to: http://dash-mssql-dev1/reportserver, this will return the page below, which contains an HTML encoded links of all the folders contained within SSRS (in a /folder/subfolder format):

b. Once you reach an RDLs (by traversing down the HTML links), you will get a link similar to the one below:

As you can see, the rs:Command is set to Render, this link will send you to the Report Manager renderer which will actually display the report. To download the report, you use the report path in the following REST URL template:

http://<server-name>/Reports/Pages/Report.aspx?ItemPath=&SelectedTabId=PropertiesTab&ViewMode=List&Export=true

Replacing <ssrs-rdl-path> with the acquired RDL path (through traversing the SSRS web service in a RESTful manner).
So for example for the SimpleTable2 report above, the path will be:

http://<server-name>/Reports/Pages/Report.aspx?ItemPath=%2fPlayground%2fSimpleTable2&SelectedTabId=PropertiesTab&ViewMode=List&Export=true

The second option is obviously a lot simpler, but as you can see its abit hacky and restrictive in terms functionality and less future proof, but probably can get the whole thing working in 10 mins.

19 votes
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>