Click to Rate and Give Feedback
TechNet
TechNet Library
SQL Server
SQL Server 2012
ReportService2005
 GetReportDefinition Method
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
ReportingService2005..::.GetReportDefinition Method

Retrieves the report definition for a report.

Namespace:  ReportService2005
Assembly:  ReportService2005 (in ReportService2005.dll)
Visual Basic (Declaration)
Public Function GetReportDefinition ( _
	Report As String _
) As Byte()
Visual Basic (Usage)
Dim instance As ReportingService2005
Dim Report As String
Dim returnValue As Byte()

returnValue = instance.GetReportDefinition(Report)
C#
public byte[] GetReportDefinition(
	string Report
)
Visual C++
public:
array<unsigned char>^ GetReportDefinition(
	String^ Report
)
F#
member GetReportDefinition : 
        Report:string -> byte[] 
JScript
public function GetReportDefinition(
	Report : String
) : byte[]

Parameters

Report
Type: System..::.String
The full path name of the report.

Return Value

Type: array<System..::.Byte>[]()[]
The report definition as a Base 64-encoded byte array. For more information about this data type, see "Byte Structure" in the Microsoft .NET Framework documentation.

The table below shows header and permissions information on this operation.

SOAP Headers

(Out) ServerInfoHeaderValue

Required Permissions

ReadReportDefinition

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:

Visual Basic
Imports System
Imports System.IO
Imports System.Web.Services.Protocols

Class Sample
   Public Shared Sub Main()
      Dim rs As New ReportingService2005
      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
C#
using System;
using System.IO;
using System.Web.Services.Protocols;

class Sample
{
   public static void Main()
   {
      ReportingService2005 rs = new ReportingService2005();
      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);
      }
   }
}
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker