共用方式為


ReportingService2010.TestConnectForItemDataSource Method

Definition

Tests the connection for a data source. This method supports the testing of published data sources that are used by reports or models and shared data sources. This method applies to the Report, Model, and Dataset item types.

public:
 bool TestConnectForItemDataSource(System::String ^ ItemPath, System::String ^ DataSourceName, System::String ^ UserName, System::String ^ Password, [Runtime::InteropServices::Out] System::String ^ % ConnectError);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/TestConnectForItemDataSource", 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("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
[System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")]
public bool TestConnectForItemDataSource (string ItemPath, string DataSourceName, string UserName, string Password, out string ConnectError);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/TestConnectForItemDataSource", 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("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
[<System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")>]
member this.TestConnectForItemDataSource : string * string * string * string * string -> bool
Public Function TestConnectForItemDataSource (ItemPath As String, DataSourceName As String, UserName As String, Password As String, ByRef ConnectError As String) As Boolean

Parameters

ItemPath
String

The fully qualified URL of the item to which the DataSourceName applies, including the file name and, in SharePoint mode, the extension. The item can be a shared data source, a report, or a report model.

DataSourceName
String

The name of the data source for the item.

UserName
String

The user name to use to test the connection.UserName is used with data sources that prompt for credentials.

Password
String

The password to use to test the connection.Password is used with data sources that prompt for credentials.

ConnectError
String

A detailed error message. The message is returned when the connection fails. The data source provider provides the detailed message.

Returns

A string that contains a detailed error message. The string is returned as the out parameter, ConnectError.

A Boolean the indicates whether the connection completed successfully.

Attributes

Remarks

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

SOAP Header Usage (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
Native Mode Required Permissions Depends on the item type:

- Report, DataSet: ReadDatasource
- Report using a model: ReadDatasource on the report AND ReadDatasource on the model
- Report using a shared data source: ReadDatasource on the report AND ReadContent on the shared data source
- DataSource: ReadContent
- Model: ReadDatasource
SharePoint Mode Required Permissions Depends on the item type:

- Report, DataSet: <xref:Microsoft.SharePoint.SPBasePermissions.OpenItems> on ItemPath
- Report using a model or a shared datasource: <xref:Microsoft.SharePoint.SPBasePermissions.OpenItems> on DataSourceName
- DataSource: <xref:Microsoft.SharePoint.SPBasePermissions.OpenItems>
- Model: <xref:Microsoft.SharePoint.SPBasePermissions.OpenItems>

If DataSourceName points to an XML data source, this method does nothing and returns true.

Applies to