Freigeben über


ReportingService2010.CreateSubscription-Methode

Creates a subscription for the specified item in the report server database or SharePoint library. This method applies to the Report item type.

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

Syntax

'Declaration
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateSubscription", 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")> _
Public Function CreateSubscription ( _
    ItemPath As String, _
    ExtensionSettings As ExtensionSettings, _
    Description As String, _
    EventType As String, _
    MatchData As String, _
    Parameters As ParameterValue() _
) As String
'Usage
Dim instance As ReportingService2010 
Dim ItemPath As String 
Dim ExtensionSettings As ExtensionSettings 
Dim Description As String 
Dim EventType As String 
Dim MatchData As String 
Dim Parameters As ParameterValue()
Dim returnValue As String 

returnValue = instance.CreateSubscription(ItemPath, _
    ExtensionSettings, Description, _
    EventType, MatchData, Parameters)
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateSubscription", 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")]
public string CreateSubscription(
    string ItemPath,
    ExtensionSettings ExtensionSettings,
    string Description,
    string EventType,
    string MatchData,
    ParameterValue[] Parameters
)
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateSubscription", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
public:
String^ CreateSubscription(
    String^ ItemPath, 
    ExtensionSettings^ ExtensionSettings, 
    String^ Description, 
    String^ EventType, 
    String^ MatchData, 
    array<ParameterValue^>^ Parameters
)
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateSubscription", 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")>]
member CreateSubscription : 
        ItemPath:string * 
        ExtensionSettings:ExtensionSettings * 
        Description:string * 
        EventType:string * 
        MatchData:string * 
        Parameters:ParameterValue[] -> string
public function CreateSubscription(
    ItemPath : String, 
    ExtensionSettings : ExtensionSettings, 
    Description : String, 
    EventType : String, 
    MatchData : String, 
    Parameters : ParameterValue[]
) : String

Parameter

  • ItemPath
    Typ: System.String
    The fully qualified URL of the item including the file name and, in SharePoint mode, the extension.
  • Description
    Typ: System.String
    A meaningful description that is displayed to users.
  • EventType
    Typ: System.String
    The type of event that triggers the subscription. The valid values are TimedSubscription or SnapshotUpdated.
  • MatchData
    Typ: System.String
    The data that is associated with the specified EventType parameter. This parameter is used by an event to match the subscription with an event that has fired.

Rückgabewert

Typ: System.String
A subscription ID that uniquely identifies the subscription in the report server database or SharePoint library.

Hinweise

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

SOAP Header Usage

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

Native Mode Required Permissions

ExecuteAndView AND (CreateAnySubscription OR CreateSubscription)

SharePoint Mode Required Permissions

ViewListItems AND (ManageAlerts OR CreateAlerts)

You can use the GetExtensionSettings method to retrieve a list of required settings for a delivery extension. You must pass values for these required settings in the ExtensionSettings parameter. For information about e-mail delivery settings, see Einstellungen der Reporting Services-Übermittlungserweiterungen.

The value of the EventType parameter must correspond to an event that is configured for the report server. The two events that are used to create subscriptions are TimedSubscription and SnapshotUpdated. Use the ListEvents method to return a list of all events configured for the report server.

The value of the MatchData parameter depends on the event type. If the event is a TimedSubscription event, a ScheduleDefinition object is required as the MatchData parameter. You must first serialize the ScheduleDefinition object as XML in order to pass it as a string value and create a subscription based on the schedule. The XML structure might resemble the one in the following example:

<ScheduleDefinition>
   <WeeklyRecurrence>
      <StartDateTime>2004-06-24T09:00:00-08:00</StartDateTime>
      <WeeksInterval>1</WeeksInterval>
      <DaysOfWeek>
         <Monday>True</Monday>
         </DaysOfWeek>
   </WeeklyRecurrence>
</ScheduleDefinition>

The value of the StartDateTime element when it is passed as an XML string should correspond to the date format ISO 8601. This international date and time standard is the extended format CCYY-MM-DDThh:mm:ss+/-Z where "CC" represents the century, "YY" the year, "MM" the month and "DD" the day. The letter "T" is the date and time separator and "hh", "mm", "ss" represent hour, minute and second respectively. This representation can be immediately followed by a "Z" to indicate Coordinated Universal Time (UTC). To indicate the time zone, represented as the difference between the local time and Coordinated Universal Time, "Z" is preceded by a "+" or "-" sign, followed by the difference from UTC represented as hh:mm.

If the schedule definition for a TimedSubscription is a shared schedule, you must pass the schedule ID of the shared schedule as the MatchData parameter. The schedule ID is passed as a String, for example, "4608ac1b-fc75-4149-9e15-5a8b5781b843". The schedule ID can be obtained by calling the ListSchedules method.

You can use the XmlSerializer class to convert your object class to an XML string automatically.

If the event is a SnapshotUpdated subscription, the value of MatchData should be nullein NULL-Verweis (Nothing in Visual Basic) (or Nothing in Visual Basic).

When this method is used, it will set the LastExecutedSpecified property of the subscription to false, the Status property of the subscription to new subscription, and all properties of the subscription’s Active object to false. The ModifiedBy and ModifiedDate properties of the report are also updated.

Any schedule specified in the MatchData parameter must be in the same site and the ItemPath.

Beispiele

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;

        string report = "http://<Server Name>" +
            "/Docs/Documents/AdventureWorks Sample Reports" +
            "/Sales Order Detail.rdl";
        string desc = "Send to Document Library";
        string eventType = "TimedSubscription";
        string scheduleXml =
           @"<ScheduleDefinition>" +
            "   <StartDateTime>2003-02-24T09:00:00-08:00" +
            "   </StartDateTime>" +
            "   <WeeklyRecurrence>" +
            "      <WeeksInterval>1</WeeksInterval>" +
            "      <DaysOfWeek>" +
            "         <Monday>True</Monday>" +
            "      </DaysOfWeek>" +
            "   </WeeklyRecurrence>" +
            "</ScheduleDefinition>";

        ParameterValue[] extensionParams = new ParameterValue[6];

        extensionParams[0] = new ParameterValue();
        extensionParams[0].Name = "RENDER_FORMAT";
        extensionParams[0].Value = "EXCEL";

        extensionParams[1] = new ParameterValue();
        extensionParams[1].Name = "FILENAME";
        extensionParams[1].Value = "Sales Order Detail";

        extensionParams[2] = new ParameterValue();
        extensionParams[2].Name = "FILEEXTN";
        extensionParams[2].Value = "True";

        extensionParams[3] = new ParameterValue();
        extensionParams[3].Name = "PATH";
        extensionParams[3].Value = "http://<Server Name>" +
            "/Docs/Documents/AdventureWorks Sample Reports/";

        extensionParams[4] = new ParameterValue();
        extensionParams[4].Name = "WRITEMODE";
        extensionParams[4].Value = "Overwrite";

        extensionParams[5] = new ParameterValue();
        extensionParams[5].Name = "AUTOCOPY";
        extensionParams[5].Value = "False";

        string matchData = scheduleXml;
        ExtensionSettings extSettings = new ExtensionSettings();
        extSettings.ParameterValues = extensionParams;
        extSettings.Extension = "Report Server DocumentLibrary";

        try
        {
            rs.CreateSubscription(report, extSettings, desc, 
                eventType, matchData, null);
        }

        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.InnerXml.ToString());
        }
    }
}
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 report As String = "http://<Server Name>/Docs/" + _
            "Documents/AdventureWorks Sample Reports/" + _
            "Sales Order Detail.rdl"
        Dim desc As String = "Send to Document Library"
        Dim eventType As String = "TimedSubscription"
        Dim scheduleXml As String = _
            "<ScheduleDefinition>" + _
            "   <StartDateTime>2003-02-24T09:00:00-08:00</StartDateTime>" + _
            "   <WeeklyRecurrence>" + _
            "      <WeeksInterval>1</WeeksInterval>" + _
            "      <DaysOfWeek>" + _
            "         <Monday>True</Monday>" + _
            "      </DaysOfWeek>" + _
            "   </WeeklyRecurrence>" + _
            "</ScheduleDefinition>"

        Dim extensionParams(6) As ParameterValue

        extensionParams(0) = New ParameterValue()
        extensionParams(0).Name = "RENDER_FORMAT"
        extensionParams(0).Value = "EXCEL"

        extensionParams(1) = New ParameterValue()
        extensionParams(1).Name = "FILENAME"
        extensionParams(1).Value = "Sales Order Detail"

        extensionParams(2) = New ParameterValue()
        extensionParams(2).Name = "FILEEXTN"
        extensionParams(2).Value = "True"

        extensionParams(3) = New ParameterValue()
        extensionParams(3).Name = "PATH"
        extensionParams(3).Value = "http://<Server Name>" + _
            "/Docs/Documents/AdventureWorks Sample Reports/"

        extensionParams(4) = New ParameterValue()
        extensionParams(4).Name = "WRITEMODE"
        extensionParams(4).Value = "Overwrite"

        extensionParams(5) = New ParameterValue()
        extensionParams(5).Name = "AUTOCOPY"
        extensionParams(5).Value = "False"

        Dim matchData As String = scheduleXml
        Dim extSettings As New ExtensionSettings()
        extSettings.ParameterValues = extensionParams
        extSettings.Extension = "Report Server DocumentLibrary"

        Try
            rs.CreateSubscription(report, extSettings, desc, _
                eventType, matchData, Nothing)
        Catch e As SoapException
            Console.WriteLine(e.Detail.InnerXml.ToString())
        End Try

    End Sub

End Class

Siehe auch

Verweis

ReportingService2010 Klasse

ReportService2010-Namespace