Export (0) Print
Expand All
Expand Minimize

ReportingService2005.CreateBatch Method

Creates a batch that executes multiple methods within a single transaction.

Namespace:  ReportService2005
Assembly:  ReportService2005 (in ReportService2005.dll)

public string CreateBatch()

Return Value

Type: String
A String that uniquely identifies a batch operation.

The table below shows header and permissions information on this operation.

SOAP Headers

(Out) ServerInfoHeaderValue

Required Permissions

The user must be a database administrator or the one configured as the unattended execution account. For more information, see Execution Account (SSRS Native Mode).

The ID returned by the CreateBatch method is used to group or batch subsequent Web service method calls. Each method included in the batch must have the batch ID specified in the SOAP header. To batch the method calls using the Microsoft .NET Framework, you must first set the BatchHeaderValue property of the Report Server Web service proxy class to a value that is equal to that of a BatchHeader object that contains a previously created batch ID.

To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example creates batch IDs for two new batches of Web service method calls and executes the batches:

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;
      }
   }
}

Community Additions

ADD
Show:
© 2014 Microsoft