語言

ReportingService2006.FireEvent(String, String, String) 方法

定義

根據所提供的參數引發事件。

public:
 void FireEvent(System::String ^ EventType, System::String ^ EventData, System::String ^ Site);
public void FireEvent(string EventType, string EventData, string Site);
member this.FireEvent : string * string * string -> unit
Public Sub FireEvent (EventType As String, EventData As String, Site As String)

參數

EventType
String

事件的名稱。

EventData
String

與事件相關的資料。

Site
String

這是 SharePoint 網站的完整 URL 。

範例

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)  
    {  
        ReportingService2006 rs = new ReportingService2006();  
        rs.Url = "http://<Server Name>" +  
            "/_vti_bin/ReportServer/ReportService2006.asmx";  
        rs.Credentials =   
            System.Net.CredentialCache.DefaultCredentials;  

        string site = "http://<Server Name>";  

        // Get the subscriptions  
        Subscription[] subs =   
            rs.ListMySubscriptions(site);  

        try  
        {  
            if (subs != null)  
            {  
                // Fire the first subscription in the list  
                rs.FireEvent("TimedSubscription",   
                    subs[0].SubscriptionID, site);  
                Console.WriteLine("Event fired.");  
            }  
        }  
        catch (Exception ex)  
        {  
            Console.WriteLine(ex.Message);  
        }  
    }  
}  
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 ReportingService2006()  
        rs.Url = "http://<Server Name>" + _  
            "/_vti_bin/ReportServer/ReportService2006.asmx"  
        rs.Credentials = _  
            System.Net.CredentialCache.DefaultCredentials  

        Dim site As String = "http://<Server Name>"  

        ' Get the subscriptions  
        Dim subs As Subscription() = _  
            rs.ListAllSubscriptions(site)  

        Try  
            If Not (subs Is Nothing) Then  
                ' Fire the first subscription in the list  
                rs.FireEvent("TimedSubscription", subs(0).SubscriptionID, site)  
                Console.WriteLine("Event fired.")  
            End If  
        Catch ex As Exception  
            Console.WriteLine(ex.Message)  
        End Try  

    End Sub  

End Class  

備註

下表顯示此操作的標頭與權限資訊。

SOAP 標頭 (在) TrustedUserHeaderValue

(出局) ServerInfoHeaderValue
必要權限 <xref:Microsoft.SharePoint.SPBasePermissions.ManageWeb>

參數 EventType 會與報告伺服器設定檔(rsreportserver.config)中定義的已知事件集合進行匹配。 若事件不在報告伺服器設定檔中,則會拋出帶有錯誤代碼的 rsUnknownEventTypeSOAP 例外。 此 FireEvent 方法僅支援事件 TimedSubscription 類型。 在指定 TimedSubscription 事件類型時,你也必須在 中指定訂閱 ID,該 ID EventData會由 CreateSubscription 或 CreateSubscription返回。

該 FireEvent 方法不會驗證或驗證參數中 EventData 提供的資料。 任何字串值皆有效,包括空字串。

適用於