SSRS get meta data of remote report

2019-07-17 22:14发布

问题:

How can I retrieve the meta data such as Description, Modified/Create Dates etc from a Remote SSRS report. The report itself displays no problems in the ReportViewer control on the aspx page so I can access the report...

there doesn't seem to be any properties for those values in the .ServerReport object...

thanks heaps!

回答1:

There are a couple of ways, one way is to add a web reference to the web services interface of your reporting server and call the GetReportDefinition method. more information here:

http://msdn.microsoft.com/en-us/library/aa258101(SQL.80).aspx

The code could look like this:


ReportingService reportingService = new ReportingService();

XmlDocument xmlDocument = null;

byte[] reportDefinition = reportingService.GetReportDefinition(ReportName);

using (MemoryStream memoryStream = new MemoryStream(reportDefinition))
{
    xmlDocument = new XmlDocument();
    xmlDocument.Load(memoryStream);
}

This gets your .rdl file that you can parse using the XML tools. You can also call the tables in the SSRS database via SQL/ADO/Linq to get the information you are after:

Some good examples of T-SQL against the reporting service database:

http://www.purplefrogsystems.com/blog/?p=13

All of the information you are after might not be in a single spot, for example, some might be in the .rdl, and some in the SQL Server database.

{6230289B-5BEE-409e-932A-2F01FA407A92}