ReportingService2010.CreateCacheRefreshPlan Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Crée un plan de rafraîchissement du cache pour un article. Cette méthode s’applique aux types d’objets Report et Dataset .
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
Paramètres
- ItemPath
- String
L’URL entièrement qualifiée de l’élément à associer au plan de rafraîchissement du cache, incluant le nom du fichier et, en mode SharePoint, l’extension.
- Description
- String
La description du plan de rafraîchissement du cache. Si ce paramètre est défini sur null (Nothing dans Visual Basic), le serveur de rapports génère automatiquement une décryption.
- EventType
- String
Le type d’événement qui déclenche le rafraîchissement du cache. Actuellement, la valeur valide est RefreshCache. Si ce paramètre est défini à null (Nothing est Visual Basic), la valeur par défaut de RefreshCache est utilisée.
- MatchData
- String
Les données associées au paramètre spécifié EventType . Cela doit être un fichier sérialisé ScheduleDefinition spécifique à l’élément dans ItemPath, ou à l’identifiant de schedule d’un schedule partagé.
- Parameters
- ParameterValue[]
Un tableau d’objets ParameterValue contenant une liste de paramètres pour l’élément spécifié dans ItemPath.
Retours
A string qui représente l’identifiant unique du plan de rafraîchissement du cache.
- Attributs
Exemples
L’exemple suivant charge un rapport dans le cache et actualise le cache quotidiennement.
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
Remarques
Le tableau ci-dessous présente les informations sur l’en-tête et les autorisations concernant cette opération.
| Utilisation de l’en-tête SOAP | (En) TrustedUserHeaderValue (Dehors) ServerInfoHeaderValue |
| Mode natif : autorisations requises | ReadPolicy ET UpdatePolicy |
| Permissions requises en mode SharePoint | <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> ET <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> |
L’utilisation EventType pour créer des plans de rafraîchissement du cache est RefreshCache. Le MatchData paramètre dépend du type d’événement. Si l’événement est un TimedSubscription événement, un ScheduleDefinition objet est requis comme MatchData paramètre. Vous devez d’abord sérialiser l’objet ScheduleDefinition en XML afin de le passer en tant que valeur de chaîne et créer un plan de rafraîchissement du cache basé sur le planning.
Vous pouvez utiliser la System.Xml.Serialization.XmlSerializer classe pour convertir automatiquement votre classe objet en chaîne XML.