ReportingService2010.ListSubscriptions Method (String)

 

Applies To: SQL Server 2016 Preview

Retrieves a list of subscriptions that have been created for a given item. This method applies to the Report item type.

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

Syntax

[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListSubscriptions", 
    RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public Subscription[] ListSubscriptions(
    string ItemPathOrSiteURL
)
public:
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListSubscriptions", 
    RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
array<Subscription^>^ ListSubscriptions(
    String^ ItemPathOrSiteURL
)
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListSubscriptions",
    RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
member ListSubscriptions : 
        ItemPathOrSiteURL:string -> Subscription[]
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/ListSubscriptions",
    RequestNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
    ResponseNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)>
<SoapHeaderAttribute("TrustedUserHeaderValue")>
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)>
Public Function ListSubscriptions (
    ItemPathOrSiteURL As String
) As Subscription()

Parameters

  • ItemPathOrSiteURL
    Type: System.String

    The fully qualified URL of the site or item including the file name and, in SharePoint mode, the extension.

    If a report server URL or SharePoint site URL is specified, all subscriptions at the given server or site is returned.

Return Value

Type: ReportService2010.Subscription[]

An array of Subscription objects that contain the subscriptions created for a given site or item.

Remarks

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

SOAP Header Usage

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

Native Mode Required Permissions

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

SharePoint Mode Required Permissions

ManageAlerts OR (CreateAlerts on the report AND the user is the subscription owner and the subscription is a timed subscription).

Examples

Legacy Code Example

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)
    {
        ReportingService2010 rs = new ReportingService2010();
        rs.Url = "http://<Server Name>/_vti_bin/ReportServer/" +
            "ReportService2010.asmx";
        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("http://<Server Name>" +
                    "/Docs/Documents/AdventureWorks Sample Reports/" +
                    "Sales Order Detail.rdl");

            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);
        }
    }
}
Imports System
Imports System.IO
Imports System.Text
Imports System.Web.Services
Imports System.Web.Services.Protocols

Class Sample

    Public Shared Sub Main()

        Dim rs As New ReportingService2010()
        rs.Url = "http://<Server Name>/_vti_bin/ReportServer/" + _
            "ReportService2010.asmx"
        rs.Credentials = _
            System.Net.CredentialCache.DefaultCredentials

        Dim extSettings As ExtensionSettings
        Dim desc As String
        Dim active As ActiveState
        Dim status As String
        Dim eventType As String
        Dim matchData As String
        Dim values As ParameterValue() = Nothing
        Dim subscriptions As Subscription() = Nothing
        Dim extensionParams As _
            ParameterValueOrFieldReference() = Nothing

        Try
            Dim report As String = "http://<Server Name>/Docs/" + _
                "Documents/AdventureWorks Sample Reports/" + _
                "Sales Order Detail.rdl"

            subscriptions = rs.ListSubscriptions(report)

            If Not (subscriptions Is Nothing) Then
                rs.GetSubscriptionProperties( _
                    subscriptions(0).SubscriptionID, extSettings, _
                    desc, active, status, eventType, _
                    matchData, 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 Not (extensionParams Is Nothing) Then
                    Dim extensionParam As _
                        ParameterValueOrFieldReference
                    For Each extensionParam In extensionParams
                        Console.WriteLine(( _
                            CType(extensionParam, _
                            ParameterValue).Name + ": " + _
                            CType(extensionParam, _
                            ParameterValue).Value))
                    Next extensionParam
                End If

                If Not (values Is Nothing) Then
                    Dim pv As ParameterValue
                    For Each pv In values
                        Console.WriteLine("Name: {0}", pv.Name)
                        Console.WriteLine("Value: {0}", pv.Value)
                    Next pv
                End If
            End If

        Catch e As SoapException
            Console.WriteLine(e.Detail.InnerXml.ToString())
        End Try

    End Sub

End Class

See Also

ReportingService2010 Class
ReportService2010 Namespace

Return to top