次の方法で共有


ReportingService2010.GetItemDefinition(String) メソッド

定義

アイテムの定義またはコンテンツを取得します。 このメソッドは、アイテムの種類 ReportModelDatasetComponentResource、および DataSource に適用されます。

public:
 cli::array <System::Byte> ^ GetItemDefinition(System::String ^ ItemPath);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetItemDefinition", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
[System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")]
public byte[] GetItemDefinition (string ItemPath);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetItemDefinition", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)>]
[<System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
[<System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")>]
member this.GetItemDefinition : string -> byte[]
Public Function GetItemDefinition (ItemPath As String) As Byte()

パラメーター

ItemPath
String

ファイル名と拡張子 (SharePoint モードの場合) を含む、アイテムの完全修飾 URL です。

戻り値

Byte[]

Base64 エンコードされたバイト配列で表したアイテム定義です。 このデータ型の詳細については、Microsoft .NET Framework のドキュメントの「Byte 構造体」を参照してください。

属性

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)  
    {  
        ReportingService2010 rs = new ReportingService2010();  
        rs.Url = "http://<Server Name>" +  
            "/_vti_bin/ReportServer/ReportService2010.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.GetItemDefinition(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 ReportingService2010()  
        rs.Url = "http://<Server Name>" + _  
            "/_vti_bin/ReportServer/ReportService2010.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.GetItemDefinition(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  

注釈

次の表に、この操作に関連するヘッダーおよび権限の情報を示します。

SOAP ヘッダーの使用方法 (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
ネイティブ モードで必要なアクセス許可 アイテムの種類によって異なります。

- Report, DataSet: ReadReportDefinition
- Resource, Component: ReadContent
- DataSource: ReadContent
- Model: ReadContent
SharePoint モードで必要なアクセス許可 <xref:Microsoft.SharePoint.SPBasePermissions.OpenItems>

適用対象