ReportingService2005.GetReportDefinition(String) Method
Definition
检索报表的报表定义。Retrieves the report definition for a report.
public:
cli::array <System::Byte> ^ GetReportDefinition(System::String ^ Report);
public byte[] GetReportDefinition (string Report);
member this.GetReportDefinition : string -> byte[]
Public Function GetReportDefinition (Report As String) As Byte()
Parameters
- Report
- String
报表的完整路径名。The full path name of the report.
Returns
- Byte[]
以 Base 64 编码格式的字节数组表示的报表定义。The report definition as a Base 64-encoded byte array. 有关这种数据类型的详细信息,请参阅 Microsoft .NET Framework 文档中的“字节结构”。For more information about this data type, see "Byte Structure" in the Microsoft .NET Framework documentation.
Examples
若要编译此代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。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. 下面的代码示例使用 GetReportDefinition 方法来检索报表的定义,并将其作为 XML 文档存储在本地文件系统中: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 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
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);
}
}
}
Remarks
下表显示了有关此操作的标头和权限信息。The table below shows header and permissions information on this operation.
SOAP 标头SOAP Headers | (Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue |
所需的权限Required Permissions | ReadReportDefinition |