Recently, I've had a few requests for how to display a list of Report Parts from SQL Server Reporting Services Report Server Web Services. This article will demonstrate how to query a list of Reports, Datasets and Report Parts using Report Server Web Service EndPoints. For this session we'll be using the ReportingServices2010 EndPoint.

5) Name the Web Reference "RS2010" and click Add Reference button to create the web reference.

6) Click OK for the next two windows.

Note: you should see RS2010 under the Web References folder.

Step 3 - Add a Web Form and include a TreeView component

1) When you create your project, the ASP.NET Web Application template should have included a default.aspx page, along with a default.aspx.cs file. If you do not have this file, please add a new web form to your project and name it "default.aspx".

2) Open the default.aspx web form in design mode.

3) Point to the Toolbox pane (if not visible) and expand the Navigation tab.

4) Drag on drop the TreeView object to the default.aspx web form.

5) From within the design pane, right click the TreeView item you just added and select properties.

6) From the properties pane on the right, name the TreeView "tvCatalog".

Steps 7-9 are optional.

7) Right click on the TreeView object and click the right arrow to expand the TreeView Tasks.

8) Select Auto Format...

9) From the Select a scheme:, select "XP File Explorer" and then click OK.

10) Save your work.

Step 4 - Consuming the ReportingServices2010 web service

1) Open the default.aspx.cs file.

2) In order to communicate with our web service we need to add the following reference to our file.

using RSIntegrationDemo.RS2010;

3) Add the following code above Page_Load(object sender, EventArgs e)

privateReportingService2010 rs;

protected void Page_Load(object sender, EventArgs e)

{

4) We need to create and instance of ReportingService2005 and pass credentials in order to authenticate to the web service. Enter the following code within the Page_Load event.

protected void Page_Load(object sender, EventArgs e)

{

rs = newReportingService2010();

// Create an instance of the Web service proxy and set the credentials

rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

if(!IsPostBack)

BuildTreeView();

}

Note: The DefaultCredentials property applies only to NTLM, negotiate, and Kerberos-based authentication. For ASP.NET applications, the default credentials are the user credentials of the logged-in user, or the user being impersonated. If you have problems authenticating, make sure the application pool account used has permissions to SSRS.

5) Next, we will add our private methods, which will populate the treeview control with report items from the catalog. The first method, BuildTreeView() creates the Parent Node for our treeview control. The Method then calls the GetCatalogItems() method, which populates the treeview control with Report Items.

Objects and Methods used:

CatalogItem - This object is used to return a report item from the report server database. We will pass an array of CatalogItem objects.

ListChildren - This will return a list of children withing a specified folder. For example, if we wanted all folder, reports, datasources, etc. returned, we would simply pass the following:

You have completed consuming Reporting Services Web Services to list Report Catalog Items - Reports, Datasets and Report Parts. Think about creating custom enums for the CatalogItems Types, so you don't have to pass the string values. Also, another potential idea is creating a custom add-in for Visual Studio 2010, which allows you to search for existing Report Parts, like in Report Builder 3.0 designer.