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

夙愿已清 提交于 2020-01-02 01:13:04

问题


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?


回答1:


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.




回答2:


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;    
}


来源:https://stackoverflow.com/questions/3169063/ssrs-get-list-of-all-reports-and-parameters-in-a-single-web-service-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!