GetDataSourceContents Method
ReportingService.GetDataSourceContents Method
Returns the contents of a data source.
Public Function GetDataSourceContents( _ ByVal DataSource As String _ ) As [Namespace].DataSourceDefinition Member of [Namespace].ReportingService
public [Namespace].DataSourceDefinition GetDataSourceContents( string DataSource ); Member of [Namespace].ReportingService
Parameters
- DataSource
- The full path name of the data source.
Return Value
A data source definition (DataSourceDefinition object) that contains the connection properties for the data source.
Permissions
| Operation | Description |
|---|---|
| Read Content | Required on the data source to view its connection properties. |
Remarks
Security Note This method may pass sensitive data, including user credentials, over a network. When possible, use SSL encryption when making Web service calls with this method. Depending on the SecureConnectionLevel setting for the report server, you may be required to use SSL when invoking this method. You can use the ListSecureMethods method to retrieve a list of methods that currently require a secure connection. For more information about the SecureConnectionLevel setting, see Using Secure Web Service Methods.
Example
To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example uses the GetDataSourceContents method to retrieve the data source definition of a shared data source and then displays the connection string and extension name as console output:
Imports System
Imports System.Web.Services.Protocols
Class Sample
Public Shared Sub Main()
Dim rs As New ReportingService()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim definition As DataSourceDefinition = Nothing
Try
definition = rs.GetDataSourceContents("/SampleReports/AdventureWorks")
Console.WriteLine("Connection String: {0}", definition.ConnectString)
Console.WriteLine("Extension name: {0}", definition.Extension)
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
End Try
End Sub 'Main
End Class 'Sample
using System;
using System.Web.Services.Protocols;
class Sample
{
public static void Main()
{
ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
DataSourceDefinition definition = null;
try
{
definition = rs.GetDataSourceContents( "/SampleReports/AdventureWorks" );
Console.WriteLine( "Connection String: {0}", definition.ConnectString );
Console.WriteLine( "Extension name: {0}", definition.Extension );
}
catch ( SoapException e )
{
Console.WriteLine( e.Detail.InnerXml.ToString() );
}
}
}