Export (0) Print
Expand All
Expand Minimize

ReportingService2010.CreateCacheRefreshPlan Method

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

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

'Declaration
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", RequestNamespace := "http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
	ResponseNamespace := "http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
	Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function CreateCacheRefreshPlan ( _
	ItemPath As String, _
	Description As String, _
	EventType As String, _
	MatchData As String, _
	Parameters As ParameterValue() _
) As String
'Usage
Dim instance As ReportingService2010 
Dim ItemPath As String 
Dim Description As String 
Dim EventType As String 
Dim MatchData As String 
Dim Parameters As ParameterValue()
Dim returnValue As String 

returnValue = instance.CreateCacheRefreshPlan(ItemPath, _
	Description, EventType, MatchData, _
	Parameters)

Parameters

ItemPath
Type: System.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.
Description
Type: System.String
The description of the cache refresh plan. If this parameter is set to Nothing (Nothing in Visual Basic), the report server automatically generates a decription.
EventType
Type: System.String
The type of event that triggers the cache refresh. Currently, the valid value is RefreshCache. If this parameter is set to Nothing (Nothing is Visual Basic), the default value of RefreshCache is used.
MatchData
Type: System.String
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.
Parameters
Type: ReportService2010.ParameterValue()
An array of ParameterValue objects that contains a list of parameters for the item specified in ItemPath.

Return Value

Type: System.String
A string that represents the unique identifier for the cache refresh plan.

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 XmlSerializer class to convert your object class to an XML string automatically.

The following example loads a report into the cache and refreshes the cache daily.

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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft