Langue

ReportingService2005.BatchHeaderValue Propriété

Définition

Obtient ou définit la valeur (BatchHeaderValueobjet) qui représente un identifiant de lot unique, généré par le système, pour les opérations multi-méthodes dans l’API SOAP de Reporting Services.

public:
 property ReportService2005::BatchHeader ^ BatchHeaderValue { ReportService2005::BatchHeader ^ get(); void set(ReportService2005::BatchHeader ^ value); };
public ReportService2005.BatchHeader BatchHeaderValue { get; set; }
member this.BatchHeaderValue : ReportService2005.BatchHeader with get, set
Public Property BatchHeaderValue As BatchHeader

Valeur de propriété

La valeur de l’en-tête batch.

Exemples

Pour compiler l’exemple de code suivant, 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 récupère une liste d’éléments dans le dossier Mes rapports d’un utilisateur, puis supprime les éléments à l’aide d’une opération batch :

Imports System  
Imports System.Web.Services.Protocols  

Class Sample  
   Public Shared Sub Main()  
      Dim rs As New ReportingService2005()  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials  

      ' Return all items in the My Reports folder.  
      Dim items As CatalogItem() = rs.ListChildren("/My Reports", False)  

      Dim bh As New BatchHeader()  
      bh.BatchID = rs.CreateBatch()  
      rs.BatchHeaderValue = bh  

      Dim item As CatalogItem  
      For Each item In  items  
         Console.WriteLine((item.Path + " found."))  
         rs.DeleteItem(item.Path)  
         Console.WriteLine((item.Path + " deleted."))  
      Next item  

      Try  
         rs.ExecuteBatch()  
      Catch ex As SoapException  
         Console.WriteLine(ex.Message)  
      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;  

      // Return all items in the My Reports folder.  
      CatalogItem[] items = rs.ListChildren("/My Reports", false);  

      BatchHeader bh = new BatchHeader();  
      bh.BatchID = rs.CreateBatch();  
      rs.BatchHeaderValue = bh;  

      foreach (CatalogItem item in items)  
      {  
         Console.WriteLine(item.Path + " found.");  
         rs.DeleteItem(item.Path);  
         Console.WriteLine(item.Path + " deleted.");  
      }  

      try  
      {  
         rs.ExecuteBatch();  
      }  
      catch (SoapException ex)  
      {  
         Console.WriteLine(ex.Message);  
      }  
      finally  
      {  
         rs.BatchHeaderValue = null;  
      }  
   }  
}  

Remarques

Vous pouvez utiliser la BatchHeaderValue propriété dans l’en-tête SOAP pour les appels de service Web que vous souhaitez regrouper.

Pour exécuter un batch, il faut définir la BatchHeaderValue propriété du service Web Report Server à une valeur égale à l’ID de lot généré lors de la création du batch. Par exemple, le code C# suivant définit le BatchHeaderValue service Web du Report Server à une valeur égale à un identifiant de lot créé précédemment, puis exécute le lot :

rs.BatchHeaderValue = bh;  
rs.ExecuteBatch();  

Pour plus d’informations sur la création d’un identifiant de lot, voir CreateBatch méthode.

S’applique à