次の方法で共有


ReportingService2010.SetDataSourceContents メソッド

DataSource に関連付けられた接続プロパティを設定します。

名前空間:  ReportService2010
アセンブリ:  ReportService2010 (ReportService2010.dll)

構文

'宣言
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/SetDataSourceContents", 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)> _
Public Sub SetDataSourceContents ( _
    DataSource As String, _
    Definition As DataSourceDefinition _
)
'使用
Dim instance As ReportingService2010 
Dim DataSource As String 
Dim Definition As DataSourceDefinition

instance.SetDataSourceContents(DataSource, _
    Definition)
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/SetDataSourceContents", 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)]
public void SetDataSourceContents(
    string DataSource,
    DataSourceDefinition Definition
)
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/SetDataSourceContents", 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)]
public:
void SetDataSourceContents(
    String^ DataSource, 
    DataSourceDefinition^ Definition
)
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/SetDataSourceContents", 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)>]
member SetDataSourceContents : 
        DataSource:string * 
        Definition:DataSourceDefinition -> unit
public function SetDataSourceContents(
    DataSource : String, 
    Definition : DataSourceDefinition
)

パラメーター

  • DataSource
    型: System.String
    ファイル名と .rsds ファイル名拡張子を含む、データ ソースの完全修飾 URL です。

説明

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

SOAP ヘッダーの使用方法

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

ネイティブ モードで必要な権限

UpdateContent

SharePoint モードで必要な権限

EditListItems

データ ソース定義の一部であるプロパティを削除するには、これらのプロパティの値に NULL (Visual Basic では Nothing) を設定します。

データ ソース定義の CredentialRetrieval プロパティに Integrated または Prompt を設定する場合は、UserName および Password には値を指定しません。 値を指定すると、エラー コード rsInvalidElementCombination の SOAP 例外が発生します。

データ ソース定義の CredentialRetrieval プロパティに Integrated または Store を設定する場合は、Prompt プロパティで指定した値は保存されません。

サブスクリプションでは、サブスクリプションを自動実行できるように、レポート サーバー データベースに資格情報を格納する必要がある場合があります。

データ ソース定義の ConnectString プロパティに NULL (Visual Basic では Nothing) を設定すると、SOAP 例外がエラー コード rsInvalidXML で発生します。 ConnectString に値を指定しない場合は、空の文字列 ("") を設定します。

このメソッドでは、Office データ接続または .odc ファイル名拡張子を持つファイルの変更はサポートされません。 このような変更を行うと、rsNotSupported エラーが発生します。 データ ソースが .rsds または .odc 以外の拡張子を持つ場合、rsWrongType エラーが返されます。

使用例

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 = 
            new DataSourceDefinition();
        definition.CredentialRetrieval = 
            CredentialRetrievalEnum.Integrated;
        definition.ConnectString = 
            "data source=(local);initial catalog=AdventureWorks";
        definition.Enabled = true;
        definition.EnabledSpecified = true;
        definition.Extension = "SQL";
        definition.ImpersonateUser = false;
        definition.ImpersonateUserSpecified = true;
        definition.Prompt = null;
        definition.WindowsCredentials = true;

        try
        {
            rs.SetDataSourceContents("http://<Server Name>" +
                "/Docs/Documents/Data Sources/AdventureWorks.rsds", 
                definition);
        }

        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.OuterXml);
        }
    }
}
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 New DataSourceDefinition()
        definition.CredentialRetrieval = _
            CredentialRetrievalEnum.Integrated
        definition.ConnectString = _
            "data source=(local);initial catalog=AdventureWorks"
        definition.Enabled = True
        definition.EnabledSpecified = True
        definition.Extension = "SQL"
        definition.ImpersonateUser = False
        definition.ImpersonateUserSpecified = True
        definition.Prompt = Nothing
        definition.WindowsCredentials = False

        Try
            rs.SetDataSourceContents("http://<Server Name>" + _
                "/Docs/Documents/Data Sources/AdventureWorks.rsds", _
                definition)

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

    End Sub

End Class

関連項目

参照

ReportingService2010 クラス

ReportService2010 名前空間