question

Phill-5640 avatar image
0 Votes"
Phill-5640 asked Phill-5640 commented

How to list files and folders on SSRS Server from VB.Net?

Hi,

I am building a Vb.net WinForms Application and I need to allow a user to select and store the path of a report on an SSRS server.

Inside the Microsoft Report Builder Tool when you select the File --> Open Report option, it loads a window that will allow you to navigate the SSRS Web Server to navigate through folders and reports. I thought I would be able to replicate the same behavior using the built-in OpenFileDialog in Vb.net however, it does not allow you to load or traverse website directories. If you try to open a site/url, an error is shown instructing you to use a different application.

Does anyone know if this is possible or if MS make the Open Report dialog available as any kind of dll/plugin?

Here is the screen I am trying to replicate.
93026-openreport.jpg

Note, it shows a Recent Sites and Servers section and allows you to read and navigate the folders on the SSRS Server. I don;t need to open the report, simply return the path back to the parent form so it can be saved with other data.


sql-server-reporting-services
openreport.jpg (49.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OlafHelper-2800 avatar image
1 Vote"
OlafHelper-2800 answered Phill-5640 commented

You can query all folder/report/data source etc from ReportServer database with

 select *
 from ReportServer.dbo.Catalog

Type
- 1 = Folder
- 2 = Report
- 5 = Data source


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Olaf,

That is exactly what I did except, I had to query 2 additional SSRS Servers to build the full list.

I just queried them separately and added them to the DataTable that was bout to the combo box.

It's probably worth mentioning that you also need to specify the "Type = 2" in the where clause otherwise, you will also see folder names and other object types.

Thanks for the help.

0 Votes 0 ·
LukasYu-msft avatar image
0 Votes"
LukasYu-msft answered

Hi,

I remembered vaguely the report builder is build on the API calling of SSRS server. I am not sure if OpenFileDialog could do this since I am not professional at winform development. But I would suggest you try in your app calling SSRS rest API for retrieving this kind of list.
You could find SSRS Rest API at Develop with the REST APIs for Reporting Services and SwaggerHub


Lukas

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OlafHelper-2800 avatar image
0 Votes"
OlafHelper-2800 answered

You can use the SSRS API to get the wanted information: Integrating Reporting Services into Applications
E.g. ReportingService2010.ListChildren(String, Boolean) Method to get all reports and subfolder.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Phill-5640 avatar image
0 Votes"
Phill-5640 answered LukasYu-msft commented

Thanks for the suggestions. I was hoping to save some time and implement the dialog box through an existing API however, it looks like I would to recreate the full UI myself. This is only a single feature in a much larger larger application so for now, the time and cost would fall outside the scope of the project.

As an alternative, I am considering building a SQL statement that queries the Catalog Table of the ReportServer database to allow the user to pic their reports via a dropdown box instead. However, if anyone has any alternative suggestions how to to create a quick way to retrieve/store the path of the report on an SSRS server, I'd be very interested in your suggestions.

For Example, in our environment, the path would look like this
SQL2005Server/ReportServer2/022_CompanyNameHere/85-PO Inventory On Order

The path isn't super complex however, I wouldn't want the user to enter this manually as I'm certain it would result in errors.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I think Olaf's query should meet your request? Did you have further questions ?

0 Votes 0 ·