Langue

ReportingService2005.CancelBatch Méthode

Définition

Annule le lot initié par un appel à la CreateBatch() méthode.

public:
 void CancelBatch();
public void CancelBatch();
member this.CancelBatch : unit -> unit
Public Sub CancelBatch ()

Exemples

Pour compiler cet exemple de code, vous devez vous référer au Reporting Services Web Service Description Language (WSDL) et importer certains espaces de noms. Pour plus d’informations, voir Exemples de compilation et exécution de code. L’exemple de code suivant annule un lot, tente de l’exécuter et affiche les détails de l’erreur :

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 bh As New BatchHeader()  
      bh.BatchID = rs.CreateBatch()  
      rs.BatchHeaderValue = bh  
      rs.CreateFolder("New Folder1", "/", Nothing)  
      rs.CreateFolder("New Folder2", "/", Nothing)  
      rs.CreateFolder("New Folder3", "/", Nothing)  

      Console.WriteLine("Cancelling current batch operation.")  

      ' Cancel the current batch.  
      Try  
         rs.CancelBatch()  

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
      End Try  

      Try  
         ' Generates an error because the batch has already been cancelled.  
         rs.ExecuteBatch()  
         Console.WriteLine("The batch executed successfully.")  

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
         Console.WriteLine("The batch was not executed.")  

      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()  
   {  
      ReportingService rs = new ReportingService2005();  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;  

      BatchHeader bh = new BatchHeader();  
      bh.BatchID = rs.CreateBatch();  
      rs.BatchHeaderValue = bh;  
      rs.CreateFolder("New Folder1", "/", null);  
      rs.CreateFolder("New Folder2", "/", null);  
      rs.CreateFolder("New Folder3", "/", null);  

      Console.WriteLine("Cancelling current batch operation.");  

      // Cancel the current batch.  
      try  
      {  
         rs.CancelBatch();  
      }  

      catch (SoapException e)  
      {  
         Console.WriteLine(e.Detail.InnerXml.ToString());  
      }  

      try  
      {  
         // Generates an error because the batch has already been cancelled.  
         rs.ExecuteBatch();  
         Console.WriteLine("The batch executed successfully.");  
      }  

      catch (SoapException e)  
      {  
         Console.WriteLine(e.Detail.InnerXml.ToString());  
         Console.WriteLine("The batch was not executed.");  
      }  

      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 (En) BatchHeaderValue

(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).

Vous devez spécifier l’ID du lot que vous souhaitez annuler avant d’appeler la CancelBatch méthode. Vous pouvez le faire en définissant la BatchHeaderValue propriété du service Web du Serveur de Rapports à une valeur égale à l’ID de lot généré lors de la création du batch.

Lorsque la CancelBatch méthode est appelée, tout appel de méthode associé à l’ID de lot ne peut plus être exécuté. Toute tentative d’exécution d’un lot avec un identifiant de lot annulé entraîne une exception SOAP avec le code rsBatchNotFoundd’erreur .

S’applique à

Voir aussi