次の方法で共有


CreateDataSource メソッド

レポート サーバー データベースまたは SharePoint ライブラリに新しいデータ ソースを作成します。

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

構文

'宣言
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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 Function CreateDataSource ( _
    DataSource As String, _
    Parent As String, _
    Overwrite As Boolean, _
    Definition As DataSourceDefinition, _
    Properties As Property() _
) As CatalogItem
'使用
Dim instance As ReportingService2010
Dim DataSource As String
Dim Parent As String
Dim Overwrite As Boolean
Dim Definition As DataSourceDefinition
Dim Properties As Property()
Dim returnValue As CatalogItem

returnValue = instance.CreateDataSource(DataSource, _
    Parent, Overwrite, Definition, Properties)
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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 CatalogItem CreateDataSource(
    string DataSource,
    string Parent,
    bool Overwrite,
    DataSourceDefinition Definition,
    Property[] Properties
)
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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:
CatalogItem^ CreateDataSource(
    String^ DataSource, 
    String^ Parent, 
    bool Overwrite, 
    DataSourceDefinition^ Definition, 
    array<Property^>^ Properties
)
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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 CreateDataSource : 
        DataSource:string * 
        Parent:string * 
        Overwrite:bool * 
        Definition:DataSourceDefinition * 
        Properties:Property[] -> CatalogItem 
public function CreateDataSource(
    DataSource : String, 
    Parent : String, 
    Overwrite : boolean, 
    Definition : DataSourceDefinition, 
    Properties : Property[]
) : CatalogItem

パラメーター

  • DataSource
    型: System. . :: . .String
    ファイル名および SharePoint モードの場合は拡張子 (.rsds) を含む、データ ソースの名前です。
  • Parent
    型: System. . :: . .String
    データ ソースを格納する親フォルダーの完全修飾 URL です。
  • Overwrite
    型: System. . :: . .Boolean
    指定した場所に同じ名前のデータ ソースが既に存在する場合に上書きするかどうかを示す Boolean 式です。

戻り値

型: ReportService2010. . :: . .CatalogItem
新しく作成されたデータ ソースの CatalogItem オブジェクトです。

説明

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

SOAP ヘッダーの使用方法

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

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

新しいデータ ソースの作成: Parent に対する CreateDatasource

既存のデータ ソースの更新: DataSource に対する UpdateContent

データ ソース プロパティの更新: DataSource に対する UpdateContent および UpdateProperties

SharePoint モードで必要な権限

新しいデータ ソースの作成: Parent に対する AddListItems()()()()

既存のデータ ソースの更新: DataSource に対する EditListItems()()()()

データ ソース名に .rsds 拡張子を含めない場合、rsFileExtensionRequired エラーが返されます。.odc 拡張子を指定した場合、rsNotSupported エラーが返されます。

エラーが発生すると、データ ソースは作成されません。

Parent パラメーターの長さは、260 文字以下でなければなりません。これを超えると、エラー コード rsItemLengthExceeded の SOAP 例外がスローされます。

Parent パラメーターを NULL または空の文字列にすることはできません。また、予約文字 : ?; @ & = + $ , \ * > < | ." を含めることもできません。スラッシュ (/) は、フォルダーの完全なパス名内の各項目を区切るために使用することはできますが、フォルダー名の末尾には使用できません。

使用例

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 name = "AdventureWorks.rsds";
        string parent = "http://<Server Name>/Docs/Documents/";

        // Define the data source definition.
        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.ImpersonateUserSpecified = false;
        //Use the default prompt string.
        definition.Prompt = null;
        definition.WindowsCredentials = false;

        try
        {
            rs.CreateDataSource(name, parent, false, 
                definition, null);
        }
        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.InnerXml.ToString());
        }
    }
}
Imports System
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 name As String = "AdventureWorks.rsds"
        Dim parent As String = "http://<Server Name>/Docs/Documents/"

        ' Define the data source definition.
        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.ImpersonateUserSpecified = False
        'Use the default prompt string.
        definition.Prompt = Nothing
        definition.WindowsCredentials = False

        Try
            rs.CreateDataSource(name, parent, False, _
                definition, Nothing)
        Catch e As SoapException
            Console.WriteLine(e.Detail.InnerXml.ToString())
        End Try

    End Sub

End Class