ReportingService2010.CreateCacheRefreshPlan(String, String, String, String, ParameterValue[]) ReportingService2010.CreateCacheRefreshPlan(String, String, String, String, ParameterValue[]) ReportingService2010.CreateCacheRefreshPlan(String, String, String, String, ParameterValue[]) Method

定义

创建项的缓存刷新计划。 Creates a cache refresh plan for an item. 此方法适用于ReportDataset项类型。 This method applies to the Report and Dataset item types.

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);
Public Function CreateCacheRefreshPlan (ItemPath As String, Description As String, EventType As String, MatchData As String, Parameters As ParameterValue()) As String
参数
ItemPath
String String String

要与缓存刷新计划关联的项的完全限定 URL,其中包括文件名(在 SharePoint 模式下,还有扩展名)。 The fully qualified URL of the item with which to associate the cache refresh plan, including the file name and, in SharePoint mode, the extension.

Description
String String String

缓存刷新计划的说明。 The description of the cache refresh plan. 如果此参数设置为null(Nothing在 Visual Basic 中),报表服务器自动生成 decription。 If this parameter is set to null (Nothing in Visual Basic), the report server automatically generates a decription.

EventType
String String String

触发缓存刷新的事件的类型。 The type of event that triggers the cache refresh. 当前有效值为 RefreshCache Currently, the valid value is RefreshCache. 如果此参数设置为null(Nothing Visual basic),默认值的RefreshCache使用。 If this parameter is set to null (Nothing is Visual Basic), the default value of RefreshCache is used.

MatchData
String String String

与指定的关联的数据EventType参数。 The data that is associated with the specified EventType parameter. 这必须是一个序列化ScheduleDefinition特定于中的项项路径,或共享计划的计划 ID。 This must be a serialized ScheduleDefinition specific to the item in ItemPath, or the schedule ID of a shared schedule.

Parameters
ParameterValue[]

数组ParameterValue对象包含的参数中指定的项列表项路径 An array of ParameterValue objects that contains a list of parameters for the item specified in ItemPath.

返回

A string ,表示缓存刷新计划的唯一标识符。 A string that represents the unique identifier for the cache refresh plan.

示例

下面的示例将报表加载到缓存,并将每天刷新缓存。The following example loads a report into the cache and refreshes the cache daily.

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  

注解

下表显示了有关此操作的标头和权限信息。The table below shows header and permissions information on this operation.

SOAP 标头使用情况SOAP Header Usage (In) TrustedUserHeaderValue(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
纯模式所需的权限Native Mode Required Permissions ReadPolicyUpdatePolicyReadPolicy AND UpdatePolicy
SharePoint 模式所需的权限SharePoint Mode Required Permissions EditListItemsViewListItemsEditListItems AND ViewListItems

EventType用于创建缓存刷新计划是RefreshCacheThe EventType used to create cache refresh plans is RefreshCache. MatchData参数取决于事件类型。The MatchData parameter depends on the event type. 如果事件是TimedSubscription事件, ScheduleDefinition ,则需要为对象MatchData参数。If the event is a TimedSubscription event, a ScheduleDefinition object is required as the MatchData parameter. 你必须先序列化为ScheduleDefinition对象作为以将其作为一个字符串值传递和创建基于计划的缓存刷新计划的 XML。You must first serialize the ScheduleDefinition object as XML in order to pass it as a string value and create a cache refresh plan based on the schedule.

你可以使用System.Xml.Serialization.XmlSerializer若要自动转换为 XML 字符串的对象类的类。You can use the System.Xml.Serialization.XmlSerializer class to convert your object class to an XML string automatically.

适用于