ReportingService2005.CreateBatch 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 lot qui exécute plusieurs méthodes au sein d’une même transaction.
public:
System::String ^ CreateBatch();
public string CreateBatch();
member this.CreateBatch : unit -> string
Public Function CreateBatch () As String
Retours
A String qui identifie de manière unique une opération batch.
Exemples
Pour compiler cet exemple de code, vous devez référencer le WSDL de Reporting Services et importer certains espaces de noms. Pour plus d’informations, voir Exemples de compilation et exécution de code. L’exemple de code suivant crée des identifiants de lot pour deux nouveaux lots d’appels de méthodes de service Web et exécute les lots :
Imports System
Imports System.Web.Services.Protocols
Class Sample
Public Shared Sub Main()
Dim rs As New ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim bh1 As New BatchHeader()
Dim bh2 As New BatchHeader()
bh1.BatchID = rs.CreateBatch()
rs.BatchHeaderValue = bh1
rs.CreateFolder("New Folder1", "/", Nothing)
rs.CreateFolder("New Folder2", "/", Nothing)
rs.CreateFolder("New Folder3", "/", Nothing)
bh2.BatchID = rs.CreateBatch()
rs.BatchHeaderValue = bh2
rs.DeleteItem("/New Folder1")
rs.DeleteItem("/New Folder2")
rs.DeleteItem("/New Folder3")
rs.BatchHeaderValue = bh1
' Create folders using a batch header 1.
Try
rs.ExecuteBatch()
Console.WriteLine("Folders created successfully.")
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
End Try
rs.BatchHeaderValue = bh2
' Delete folders using batch header 2.
Try
rs.ExecuteBatch()
Console.WriteLine("Folders deleted successfully.")
Catch e As SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
Finally
rs.BatchHeaderValue = Nothing
End Try
End Sub 'Main
End Class 'Sample
using System;
using System.Web.Services.Protocols;
class Sample
{
public static void Main()
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
BatchHeader bh1 = new BatchHeader();
BatchHeader bh2 = new BatchHeader();
bh1.BatchID = rs.CreateBatch();
rs.BatchHeaderValue = bh1;
rs.CreateFolder("New Folder1", "/", null);
rs.CreateFolder("New Folder2", "/", null);
rs.CreateFolder("New Folder3", "/", null);
bh2.BatchID = rs.CreateBatch();
rs.BatchHeaderValue = bh2;
rs.DeleteItem("/New Folder1");
rs.DeleteItem("/New Folder2");
rs.DeleteItem("/New Folder3");
rs.BatchHeaderValue = bh1;
// Create folders using a batch header 1.
try
{
rs.ExecuteBatch();
Console.WriteLine("Folders created successfully.");
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
rs.BatchHeaderValue = bh2;
// Delete folders using batch header 2.
try
{
rs.ExecuteBatch();
Console.WriteLine("Folders deleted successfully.");
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
finally
{
rs.BatchHeaderValue = null;
}
}
}
Remarques
Le tableau ci-dessous présente les informations sur l’en-tête et les autorisations concernant cette opération.
| En-têtes SOAP | (Dehors) ServerInfoHeaderValue |
| Autorisations requises | L’utilisateur doit être un administrateur de base de données ou celui configuré comme compte d’exécution non surveillé. Pour plus d’informations, voir Compte d’exécution (Mode natif SSRS). |
L’ID retourné par la CreateBatch méthode est utilisé pour regrouper ou regrouper les appels ultérieurs de la méthode Web Service. Chaque méthode incluse dans le lot doit avoir l’ID de lot spécifié dans l’en-tête SOAP. Pour regrouper les appels de méthode à l’aide du Microsoft .NET Framework, vous devez d’abord définir la BatchHeaderValue propriété de la classe proxy du service Web Report Server à une valeur égale à celle d’un BatchHeader objet contenant un identifiant de lot créé précédemment.