ReportingService2010.CreateDataSource メソッド

定義

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

public:
 ReportService2010::CatalogItem ^ CreateDataSource(System::String ^ DataSource, System::String ^ Parent, bool Overwrite, ReportService2010::DataSourceDefinition ^ Definition, cli::array <ReportService2010::Property ^> ^ Properties);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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("TrustedUserHeaderValue")]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public ReportService2010.CatalogItem CreateDataSource(string DataSource, string Parent, bool Overwrite, ReportService2010.DataSourceDefinition Definition, ReportService2010.Property[] Properties);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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("TrustedUserHeaderValue")>]
[<System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
member this.CreateDataSource : string * string * bool * ReportService2010.DataSourceDefinition * ReportService2010.Property[] -> ReportService2010.CatalogItem
Public Function CreateDataSource (DataSource As String, Parent As String, Overwrite As Boolean, Definition As DataSourceDefinition, Properties As Property()) As CatalogItem

パラメーター

DataSource
String

データソースの名前(ファイル名を含む)、SharePointモードでは拡張子(.rsds)が含まれます。

Parent
String

データソースを含む親フォルダの完全限定URLです。

Overwrite
Boolean

指定された場所で同じ名前の既存データソースを上書きすべきかどうかを示す Boolean 式。

Definition
DataSourceDefinition

データソースの接続プロパティを記述する DataSourceDefinition オブジェクトです。

Properties
Property[]

データソース Property 設定するプロパティ名と値を定義するオブジェクトの配列です。

返品

新たに作成されたデータソースのための CatalogItem オブジェクト。

属性

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  

注釈

以下の表は、この操作のヘッダーおよび権限情報を示しています。

SOAPヘッダーの使用 (イン) TrustedUserHeaderValue

(アウト) ServerInfoHeaderValue
ネイティブモードの必要権限 新しいデータソースの作成: CreateDatasource on Parent

既存データソースの更新:UpdateContentDataSource

データソースプロパティの更新:UpdateContent AND UpdatePropertiesDataSource
SharePointモードの必要権限 新しいデータソースの作成: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> on Parent

既存データソースの更新:<xref:Microsoft.SharePoint.SPBasePermissions.EditListItems>DataSource

.rsds拡張子がデータソース名から除外されると、 rsFileExtensionRequired エラーが返されます。 .odc拡張子が与えられると、 rsNotSupported エラーが返されます。

エラーが発生した場合、データソースは作成されません。

Parentパラメータの長さは260文字を超えてはなりません。そうでなければ、エラーコードrsItemLengthExceedでSOAP例外が発生します。

Parentパラメータはnullや空であってはならず、以下の保留文字を含むことはできません:: ? ; @ & = + $ , \ * > < | . "。 フォルダーのフルパス名の項目を区切るためにスラッシュ文字(/)を使うことはできますが、フォルダ名の最後に使うことはできません。

適用対象