Jason La
Jason La

Reputation: 1081

SSRS: Get list of all reports and parameters in a single web service call?

Short and sweet version: Is there a single web service method that would return the names of all available reports, and each report's parameters?

I have my web code (C#/MVC) connected to a SSRS web service, and I am able to retrieve reports through those services.

I know I can get a list of available reports like this:

var rService = new ReportingService2005
{
 Url = @"http://domain.com/ReportServer/ReportService2005.asmx?wsdl",
 Credentials = System.Net.CredentialCache.DefaultCredentials
};

var reportList = rService.ListChildren(@"/Blah", true);

The result of ListChildren() gives a lot of information, but it doesn't list the parameters for each report. In order to get the parameter for a report, I need to make a separate call:

string historyId = null;
ReportService.ParameterValue[] values = null;
ReportService.DataSourceCredentials[] credentials = null;

var parameters = rService.GetReportParameters(@"/Blah/" + reportName, historyId, true, values, credentials);

So if I want to get all available reports and their parameters, I would need to loop through the results of ListChildren, which means I would be making a web service call for each of those reports.

Is there a better way of doing this?

Upvotes: 11

Views: 12771

Answers (2)

Bharat
Bharat

Reputation: 6095

i used ListChildren these way.

ReportingService2005 rService = new ReportingService2005();
rService.Credentials = System.Net.CredentialCache.DefaultCredentials;

CatalogItem[] catalogItems = rService.ListChildren("/", true);

these will give you all reports, folders and data source from Report manager. then filter it with your code like,

foreach (CatalogItem item in catalogItems.Where(m => m.Name.ToLower().Contains(model.ReportName.ToLower())))
{
  Your code;    
}

Upvotes: 0

Jason Horner
Jason Horner

Reputation: 3690

There is not such a call bulitin to the webservices interface. As an alternative, you could achieve something similar by directly querying the reporting services systems tables in the ReportServer DB; but this is going to be version dependant, and MS probably will not support it.

That being said I have used these tables to create several adhoc reports in the past. and did not experience any problems YMMV.

Upvotes: 1

Related Questions