共用方式為


ReportingService2010.GetDataSourceContents 方法

Returns the contents of a data source.

命名空間:  ReportService2010
組件:  ReportService2010 (在 ReportService2010.dll 中)

語法

'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetDataSourceContents", RequestNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
    ResponseNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
Public Function GetDataSourceContents ( _
    DataSource As String _
) As DataSourceDefinition
'用途
Dim instance As ReportingService2010 
Dim DataSource As String 
Dim returnValue As DataSourceDefinition 

returnValue = instance.GetDataSourceContents(DataSource)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetDataSourceContents", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public DataSourceDefinition GetDataSourceContents(
    string DataSource
)
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetDataSourceContents", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
public:
DataSourceDefinition^ GetDataSourceContents(
    String^ DataSource
)
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetDataSourceContents", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
member GetDataSourceContents : 
        DataSource:string -> DataSourceDefinition
public function GetDataSourceContents(
    DataSource : String
) : DataSourceDefinition

參數

  • DataSource
    型別:System.String
    The fully qualified URL of the data source including the file name and .rsds or .odc file name extension.

傳回值

型別:ReportService2010.DataSourceDefinition
A DataSourceDefinition object that contains the connection properties for the data source. The Password field is not retrieved from the server and this property of the DataSourceDefinition object is always set to null.

備註

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

SOAP Header Usage

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

Native Mode Required Permissions

ReadContent

SharePoint Mode Required Permissions

OpenItems

範例

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;

        DataSourceDefinition definition = null;

        try
        {
            definition = rs.GetDataSourceContents(
                "http://<Server Name>/Docs/Documents/" +
                "Data Sources/AdventureWorks.rsds");
            Console.WriteLine("Connection String: {0}", 
                definition.ConnectString);
            Console.WriteLine("Extension name: {0}", 
                definition.Extension);
        }

        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.InnerXml.ToString());
        }
    }
}
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 definition As DataSourceDefinition = Nothing

        Try
            definition = _
                rs.GetDataSourceContents("http://<Server Name>" + _
                "/Docs/Documents/Data Sources/AdventureWorks.rsds")
            Console.WriteLine("Connection String: {0}", _
                definition.ConnectString)
            Console.WriteLine("Extension name: {0}", _
                definition.Extension)

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

    End Sub

End Class

請參閱

參考

ReportingService2010 類別

ReportService2010 命名空間