Export (0) Print
Expand All
Expand Minimize

GetReportDataSource Method

SQL Server 2000

ReportingService.GetReportDataSources Method

Returns the values of properties that are associated with the data sources of a report.

Public GetReportDataSources( _
   ByVal Report As String _
) As [Namespace].DataSource()
   Member of [Namespace].ReportingService

public [Namespace].DataSource[] GetReportDataSources(
   string Report
   Member of [Namespace].ReportingService
The full path name of the report.
Return Value

An array of DataSource[] objects that represents the data sources that are associated with a report and their properties.


Operation Description
Read Data Sources Required on the report to view data source properties. Required on any data sources that exist as named items in the report server database.


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.


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 GetReportDataSources method to retrieve data source information that is stored in the report "Company Sales" and uses that data to create shared data sources in the root folder:

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 parent As String = "/"
      Dim dataSources As DataSource() = Nothing
         dataSources = rs.GetReportDataSources("/SampleReports/Company Sales")
         If Not (dataSources Is Nothing) Then
            Dim ds As DataSource
            For Each ds In  dataSources
               If TypeOf ds.Item Is DataSourceDefinition Then
                  Dim definition As DataSourceDefinition = CType(ds.Item, DataSourceDefinition)
                  rs.CreateDataSource(ds.Name, parent, definition, Nothing)
               End If
            Next ds
         End If
      Catch e As SoapException
      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;

      string parent = "/";
      DataSource[] dataSources = null;

         dataSources = rs.GetReportDataSources("/SampleReports/Company Sales");

         if ( dataSources != null )
            foreach (DataSource ds in dataSources)
               if (ds.Item is DataSourceDefinition)
                  DataSourceDefinition definition = (DataSourceDefinition) ds.Item;
                  rs.CreateDataSource(ds.Name, parent, definition, null);

      catch (SoapException e)
See Also

ReportingService Class

Reporting Services Web Service Library

© 2014 Microsoft