ReportingService2010.CreateCacheRefreshPlan 方法

定义

创建项的缓存刷新计划。 此方法适用于ReportDataset项类型。

public:
 System::String ^ CreateCacheRefreshPlan(System::String ^ ItemPath, System::String ^ Description, System::String ^ EventType, System::String ^ MatchData, cli::array <ReportService2010::ParameterValue ^> ^ Parameters);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public string CreateCacheRefreshPlan (string ItemPath, string Description, string EventType, string MatchData, ReportService2010.ParameterValue[] Parameters);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)>]
[<System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")>]
[<System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
member this.CreateCacheRefreshPlan : string * string * string * string * ReportService2010.ParameterValue[] -> string
Public Function CreateCacheRefreshPlan (ItemPath As String, Description As String, EventType As String, MatchData As String, Parameters As ParameterValue()) As String

参数

ItemPath
String

要与缓存刷新计划关联的项的完全限定 URL,其中包括文件名(在 SharePoint 模式下,还有扩展名)。

Description
String

缓存刷新计划的说明。 如果将此参数设置为 null(Visual Basic 中为 Nothing),则报表服务器自动生成说明。

EventType
String

触发缓存刷新的事件的类型。 当前有效值为 RefreshCache。 如果将此参数设置为 null(Visual Basic 中为 Nothing),则使用默认值 RefreshCache

MatchData
String

与指定 EventType 参数关联的数据。 这必须是特定于 中的ItemPath项的序列化ScheduleDefinition,或者是共享计划的计划 ID。

Parameters
ParameterValue[]

对象的数组 ParameterValue ,其中包含中指定的 ItemPath项的参数列表。

返回

一个string,该字符串表示缓存刷新计划的唯一标识符。

属性

示例

以下示例将报表加载到缓存中,并每天刷新缓存。

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 = "Daily refresh of the report cache, starting 2/22/2010 at 2:15am";  
        string eventType = "RefreshCache";  
        ScheduleDefinition definition =   
            new ScheduleDefinition();  
        // Create the schedule definition.  
        definition.StartDateTime =  
        new DateTime(2010, 2, 22, 10, 15, 0);  
        DailyRecurrence recurrence =   
            new DailyRecurrence();  
        recurrence.DaysInterval = 1;  
        definition.Item = recurrence;  
        // Serialize schedule definition  
        System.Xml.Serialization.XmlSerializer serializer =   
            new System.Xml.Serialization.XmlSerializer(  
                typeof(ScheduleDefinition));  
        MemoryStream stream = new MemoryStream();  
        serializer.Serialize(stream, definition);  
        UTF8Encoding encoding = new UTF8Encoding();  
        string defString = encoding.GetString(stream.ToArray());  

        try  
        {  
            rs.CreateCacheRefreshPlan(report, desc, eventType,   
                defString, 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 = " Daily refresh of the report cache, _  
            starting 2/22/2010 at 2:15am."  

        Dim eventType As String = "RefreshCache"  
        Dim definition As New ScheduleDefinition()  
        ' Create the schedule definition.  
        definition.StartDateTime = New DateTime(2010, 2, 22, 10, 15, 0)  
        Dim recurrence As New DailyRecurrence()  
        recurrence.DaysInterval = 1  
        definition.Item = recurrence  
        Dim serializer As New System.Xml.Serialization.XmlSerializer(_  
            GetType(ScheduleDefinition))  
        Dim stream As New MemoryStream()  
        serializer.Serialize(stream, definition)  
        Dim encoding As New UTF8Encoding()  
        Dim defString As String = encoding.GetString(stream.ToArray())  

        Try  
            rs.CreateCacheRefreshPlan(report, desc, eventType,   
                defString, Nothing)  
        Catch e As SoapException  
            Console.WriteLine(e.Detail.InnerXml.ToString())  
        End Try  

    End Sub  

End Class  

注解

下表显示了有关此操作的标头和权限信息。

SOAP 标头用法 (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
本机模式所需权限 ReadPolicyUpdatePolicy
SharePoint 模式所需权限 <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> 和 <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems>

EventType用于创建缓存刷新计划的 是 RefreshCache。 参数 MatchData 取决于事件类型。 如果该事件是事件 TimedSubscription ,则需要对象 ScheduleDefinition 作为 MatchData 参数。 必须先将 ScheduleDefinition 对象序列化为 XML,以便将其作为字符串值传递,并根据计划创建缓存刷新计划。

可以使用 System.Xml.Serialization.XmlSerializer 类自动将对象类转换为 XML 字符串。

适用于