ReportingService2006.CreateDataSource 메서드

정의

SharePoint 라이브러리에 새 데이터 원본을 만듭니다.

public:
 ReportService2006::CatalogItem ^ CreateDataSource(System::String ^ DataSource, System::String ^ Parent, bool Overwrite, ReportService2006::DataSourceDefinition ^ Definition, cli::array <ReportService2006::Property ^> ^ Properties);
public ReportService2006.CatalogItem CreateDataSource (string DataSource, string Parent, bool Overwrite, ReportService2006.DataSourceDefinition Definition, ReportService2006.Property[] Properties);
member this.CreateDataSource : string * string * bool * ReportService2006.DataSourceDefinition * ReportService2006.Property[] -> ReportService2006.CatalogItem
Public Function CreateDataSource (DataSource As String, Parent As String, Overwrite As Boolean, Definition As DataSourceDefinition, Properties As Property()) As CatalogItem

매개 변수

DataSource
String

파일 이름과 확장명(.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)  
    {  
        ReportingService2006 rs = new ReportingService2006();  
        rs.Url = "http://<Server Name>" +   
            "/_vti_bin/ReportServer/ReportService2006.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 ReportingService2006()  
        rs.Url = "http://<Server Name>" + _  
            "/_vti_bin/ReportServer/ReportService2006.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 헤더 (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
필요한 권한 새 데이터 원본 만들기: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> 켜기 Parent

기존 데이터 원본 업데이트: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> 켜기 DataSource

.rsds 확장이 데이터 원본 이름 rsFileExtensionRequired 에서 제외되면 오류가 반환됩니다. .odc 확장이 제공 rsNotSupported 되면 오류가 반환됩니다.

오류가 발생하면 데이터 원본이 만들어지지 않습니다.

매개 변수의 Parent 길이는 260자를 초과할 수 없습니다. 그렇지 않으면 오류 코드 rsItemLengthExceeded와 함께 SOAP 예외가 throw됩니다.

매개 변수는 Parent null이거나 비어 있거나 예약된 문자를 : ? ; @ & = + $ , \ * > < | . "포함할 수 없습니다. 슬래시 문자(/)를 사용하여 폴더의 전체 경로 이름에 있는 항목을 구분할 수 있지만 폴더 이름 끝에는 사용할 수 없습니다.

적용 대상