CreateCacheRefreshPlan 方法

创建项的缓存刷新计划。此方法适用于报表和数据集项类型。

命名空间:  ReportService2010
程序集:  ReportService2010(在 ReportService2010.dll 中)

语法

声明
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", RequestNamespace := "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer",  _
    ResponseNamespace := "https://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
用法
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)
[SoapHeaderAttribute("TrustedUserHeaderValue")]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string CreateCacheRefreshPlan(
    string ItemPath,
    string Description,
    string EventType,
    string MatchData,
    ParameterValue[] Parameters
)
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
public:
String^ CreateCacheRefreshPlan(
    String^ ItemPath, 
    String^ Description, 
    String^ EventType, 
    String^ MatchData, 
    array<ParameterValue^>^ Parameters
)
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCacheRefreshPlan", RequestNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
member CreateCacheRefreshPlan : 
        ItemPath:string * 
        Description:string * 
        EventType:string * 
        MatchData:string * 
        Parameters:ParameterValue[] -> string 
public function CreateCacheRefreshPlan(
    ItemPath : String, 
    Description : String, 
    EventType : String, 
    MatchData : String, 
    Parameters : ParameterValue[]
) : String

参数

  • ItemPath
    类型:System. . :: . .String
    要与缓存刷新计划关联的项的完全限定 URL,其中包括文件名(在 SharePoint 模式下,还有扩展名)。
  • Description
    类型:System. . :: . .String
    缓存刷新计划的说明。如果将此参数设置为 nullNothingnullptrunitnull 引用(在 Visual Basic 中为 Nothing)(Visual Basic 中为 Nothing),则报表服务器自动生成说明。
  • EventType
    类型:System. . :: . .String
    触发缓存刷新的事件的类型。当前有效值为 RefreshCache。如果将此参数设置为 nullNothingnullptrunitnull 引用(在 Visual Basic 中为 Nothing)(Visual Basic 中为 Nothing),则使用默认值 RefreshCache。
  • MatchData
    类型:System. . :: . .String
    与指定的 EventType 参数关联的数据。它必须是 ItemPath 中特定于该项的序列化 ScheduleDefinition,或者是共享计划的计划 ID。

返回值

类型:System. . :: . .String
一个字符串,该字符串表示缓存刷新计划的唯一标识符。

注释

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.

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