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


Creates a cache refresh plan for an item. This method applies to the Report and Dataset item types.

 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("", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="", ResponseNamespace="", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[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);
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



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.


The description of the cache refresh plan. If this parameter is set to null (Nothing in Visual Basic), the report server automatically generates a decription.


The type of event that triggers the cache refresh. Currently, the valid value is RefreshCache. If this parameter is set to null (Nothing is Visual Basic), the default value of RefreshCache is used.


The data that is associated with the specified EventType parameter. This must be a serialized ScheduleDefinition specific to the item in ItemPath, or the schedule ID of a shared schedule.


An array of ParameterValue objects that contains a list of parameters for the item specified in ItemPath.



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>" +  
        rs.Credentials =   
        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(  
        MemoryStream stream = new MemoryStream();  
        serializer.Serialize(stream, definition);  
        UTF8Encoding encoding = new UTF8Encoding();  
        string defString = encoding.GetString(stream.ToArray());  
            rs.CreateCacheRefreshPlan(report, desc, eventType,   
                defString, null);  
        catch (SoapException e)  
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>" + _  
        rs.Credentials = _  
        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(_  
        Dim stream As New MemoryStream()  
        serializer.Serialize(stream, definition)  
        Dim encoding As New UTF8Encoding()  
        Dim defString As String = encoding.GetString(stream.ToArray())  
            rs.CreateCacheRefreshPlan(report, desc, eventType,   
                defString, Nothing)  
        Catch e As SoapException  
        End Try  
    End Sub  
End Class  


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

SOAP Header Usage (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
Native Mode Required Permissions ReadPolicy AND UpdatePolicy
SharePoint Mode Required Permissions EditListItems AND ViewListItems

The EventType used to create cache refresh plans is RefreshCache. 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 cache refresh plan based on the schedule.

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

Applies to