Share via


ReportingService2006.GetReportDefinition Method

Retrieves the report definition for a report.

Namespace:  ReportService2006
Assembly:  ReportService2006 (in ReportService2006.dll)

Syntax

'Declaration
Public Function GetReportDefinition ( _
    Report As String _
) As Byte()
'Usage
Dim instance As ReportingService2006 
Dim Report As String 
Dim returnValue As Byte()

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

Parameters

  • Report
    Type: System.String
    The fully qualified URL of the report including the file name and .rdl file name extension.

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.

Remarks

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

SOAP Headers

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

Required Permissions

OpenItems

Examples

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

class Sample
{
    static void Main(string[] args)
    {
        ReportingService2006 rs = new ReportingService2006();
        rs.Url = "http://<Server Name>" +
            "/_vti_bin/ReportServer/ReportService2006.asmx";
        rs.Credentials = 
            System.Net.CredentialCache.DefaultCredentials;

        string reportName = "http://<Server Name>/Docs/Documents" +
            "/AdventureWorks Sample Reports/Sales Order Detail.rdl";
        byte[] reportDefinition = null;
        System.Xml.XmlDocument doc = new System.Xml.XmlDocument();

        try
        {
            reportDefinition = rs.GetReportDefinition(reportName);
            MemoryStream stream = new MemoryStream(reportDefinition);

            string myDocumentsFolder = 
                Environment.GetFolderPath(
                    Environment.SpecialFolder.Personal);

            doc.Load(stream);
            doc.Save(Path.Combine(myDocumentsFolder, 
                "Sales Order Detail.rdl"));
        }
        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.InnerXml.ToString());
        }
        catch (IOException e)
        {
            Console.WriteLine(e.Message);
        }
    }
}
Imports System
Imports System.IO
Imports System.Text
Imports System.Web.Services
Imports System.Web.Services.Protocols

Class Sample

    Public Shared Sub Main()

        Dim rs As New ReportingService2006()
        rs.Url = "http://<Server Name>" + _
            "/_vti_bin/ReportServer/ReportService2006.asmx"
        rs.Credentials = _
            System.Net.CredentialCache.DefaultCredentials

        Dim reportName As String = "http://<Server Name>" + _
            "/Docs/Documents/AdventureWorks Sample Reports" + _
            "/Sales Order Detail.rdl"
        Dim reportDefinition As Byte() = Nothing
        Dim doc As New System.Xml.XmlDocument

        Try
            reportDefinition = rs.GetReportDefinition(reportName)
            Dim stream As New MemoryStream(reportDefinition)

            Dim myDocumentsFolder As String = _
                My.Computer.FileSystem.SpecialDirectories.MyDocuments
            doc.Load(stream)
            doc.Save(Path.Combine(myDocumentsFolder, _
                "Sales Order Detail.rdl"))

        Catch e As SoapException
            Console.WriteLine(e.Detail.InnerXml.ToString())
        Catch e As IOException
            Console.WriteLine(e.Message)
        End Try

    End Sub

End Class

See Also

Reference

ReportingService2006 Class

ReportService2006 Namespace