GetReportDefinition Method
ReportingService.GetReportDefinition Method
Retrieves the report definition for a report.
Public Function GetReportDefinition( _ ByVal Report As String _ ) As Byte() Member of [Namespace].ReportingService
public Byte[] GetReportDefinition( string Report ); Member of [Namespace].ReportingService
Parameters
- Report
- The full path name of the report.
Return Value
The report definition as a Base 64-encoded byte array. For more information about this data type, see "Byte Structure" in the .NET Framework documentation.
Permissions
| Operation | Description |
|---|---|
| Read Report Definition | Required to read the report definition of the report. |
Remarks
Security Note This method may pass sensitive data, including user credentials, over a network. When possible, use SSL encryption when making Web service calls with this method. Depending on the SecureConnectionLevel setting for the report server, you may be required to use SSL when invoking this method. You can use the ListSecureMethods method to retrieve a list of methods that currently require a secure connection. For more information about the SecureConnectionLevel setting, see Using Secure Web Service Methods.
Example
To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example uses the GetReportDefinition method to retrieve the definition of a report and store it as an XML document in the local file system:
Imports System
Imports System.IO
Imports System.Web.Services.Protocols
Class Sample
Public Shared Sub Main()
Dim rs As New ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim reportName As String = "/SampleReports/Company Sales"
Dim reportDefinition As Byte() = Nothing
Dim doc As New System.Xml.XmlDocument
Try
reportDefinition = rs.GetReportDefinition(reportName)
Dim stream As New MemoryStream(reportDefinition)
doc.Load(stream)
doc.Save("C:\Company Sales.rdl")
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
Catch e As IOException
Console.WriteLine(e.Message)
End Try
End Sub 'Main
End Class 'Sample
using System;
using System.IO;
using System.Web.Services.Protocols;
class Sample
{
public static void Main()
{
ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
string reportName = "/SampleReports/Company Sales";
byte[] reportDefinition = null;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
try
{
reportDefinition = rs.GetReportDefinition(reportName);
MemoryStream stream = new MemoryStream(reportDefinition);
doc.Load(stream);
doc.Save(@"C:\Company Sales.rdl");
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
catch (IOException e)
{
Console.WriteLine(e.Message);
}
}
}