Export (0) Print
Expand All
Expand Minimize

ReportingService2005.ListSubscriptions Method

Returns a list of subscriptions that a user has created for a given report. The list includes both standard and data-driven subscriptions.

Namespace:  ReportService2005
Assembly:  ReportService2005 (in ReportService2005.dll)

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/ListSubscriptions", RequestNamespace = "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
	ResponseNamespace = "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public Subscription[] ListSubscriptions(
	string Report,
	string Owner
)

Parameters

Report
Type: System.String
The full path name of the report.
Owner
Type: System.String
The user name for which to retrieve the subscriptions.

Return Value

Type: ReportService2005.Subscription[]
An array of Subscription objects that represent the user's subscriptions for a given report.

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

SOAP Headers

(Out) ServerInfoHeaderValue

Required Permissions

(ReadSubscription on the report AND the user is the subscription owner) OR ReadAnySubscription

You can supply a null (Nothing in Visual Basic) value for the Owner and Report parameters. The information that the ListSubscriptions method returns varies depending on the parameters that are submitted:

  • If the values of both Owner and Report are null, the method returns all subscriptions for all reports that the current user has permission to view.

  • If only the Owner parameter is submitted, the method returns all subscriptions for all reports that the specified user has created and has permission to view.

  • If only the Report parameter is submitted, the method returns all subscriptions for all users of the specified report that the current user has permission to view.

  • If valid values are supplied for both the Owner parameter and Report parameter, the method returns all subscriptions for the specified report that the specified user created and has permission to view.

To compile the following code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following example code uses the ListSubscriptions method to retrieve a list of subscriptions for the Employee Sales Summary report, which is owned by the user myDomain\myUserName:

using System;
using System.Web.Services.Protocols;

class Sample
{
   public static void Main()
   {
      ReportingService2005 rs = new ReportingService2005();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

      ExtensionSettings extSettings;
      string desc;
      ActiveState active;
      string status;
      string eventType;
      string matchData;
      ParameterValue[] values = null;
      Subscription[] subscriptions = null;
      ParameterValueOrFieldReference[] extensionParams = null;

      try
      {
         subscriptions = rs.ListSubscriptions("/SampleReports/Employee Sales Summary",
            @"myDomain\myUserName");

         if ( subscriptions != null )
         {
            // Retrieve properties for the first subscription in the list.
            rs.GetSubscriptionProperties(subscriptions[0].SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out values);

            Console.WriteLine("Description: {0}", desc);
            Console.WriteLine("Status: {0}", status);
            Console.WriteLine("EventType: {0}", eventType);
            Console.WriteLine("matchData: {0}", matchData);
            Console.WriteLine("Extension: {0}", extSettings.Extension);

            extensionParams = extSettings.ParameterValues;

            if (extensionParams != null)
            {
               foreach (ParameterValueOrFieldReference extensionParam in extensionParams)
               {
                  Console.WriteLine(((ParameterValue)extensionParam).Name + ": " + ((ParameterValue)extensionParam).Value);
               }
            }

            if (values != null)
            {
               foreach (ParameterValue pv in values)
               {
                  Console.WriteLine("Name: {0}", pv.Name);
                  Console.WriteLine("Value: {0}", pv.Value);
               }
            }
         }
      }

      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.OuterXml); 
      }
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft