ReportingService2005.CreateBatch Méthode

Définition

Crée un lot qui exécute plusieurs méthodes dans une transaction unique.

public:
 System::String ^ CreateBatch();
public string CreateBatch ();
member this.CreateBatch : unit -> string
Public Function CreateBatch () As String

Retours

String qui identifie de manière unique une opération de traitement par lot.

Exemples

Pour compiler cet exemple de code, vous devez référencer le Reporting Services WSDL et importer certains espaces de noms. Pour plus d’informations, consultez Compilation et exécution d’exemples de code. L’exemple de code suivant crée des ID de lot pour deux nouveaux lots d’appels de méthode 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 suivant présente les informations relatives aux en-têtes et aux autorisations sur cette opération.

En-têtes SOAP (Out) ServerInfoHeaderValue
Autorisations requises L’utilisateur doit être un administrateur de base de données ou celui configuré comme compte d’exécution sans assistance. Pour plus d’informations, consultez Compte d’exécution (mode natif SSRS).

L’ID retourné par la CreateBatch méthode est utilisé pour regrouper ou traiter par lot les appels de méthode de service Web suivants. Chaque méthode incluse dans le lot doit avoir l’ID de lot spécifié dans l’en-tête SOAP. Pour traiter par lot les appels de méthode à l’aide de Microsoft .NET Framework, vous devez d’abord définir la BatchHeaderValue propriété de la classe proxy du service Web Report Server sur une valeur égale à celle d’un BatchHeader objet qui contient un ID de lot créé précédemment.

S’applique à

Voir aussi