次の方法で共有


BatchHeaderValue プロパティ

Reporting Services の SOAP API のマルチメソッド操作に対して、システムが生成した一意のバッチ ID を表す値 (BatchHeaderValue オブジェクト) です。

名前空間:  ReportService2005
アセンブリ:  ReportService2005 (ReportService2005.dll)

構文

'宣言
Public Property BatchHeaderValue As BatchHeader
    Get
    Set
'使用
Dim instance As ReportingService2005
Dim value As BatchHeader

value = instance.BatchHeaderValue

instance.BatchHeaderValue = value
public BatchHeader BatchHeaderValue { get; set; }
public:
property BatchHeader^ BatchHeaderValue {
    BatchHeader^ get ();
    void set (BatchHeader^ value);
}
member BatchHeaderValue : BatchHeader with get, set
function get BatchHeaderValue () : BatchHeader
function set BatchHeaderValue (value : BatchHeader)

プロパティ値

型: ReportService2005. . :: . .BatchHeader

説明

バッチにまとめたい Web サービス呼び出しでは、SOAP ヘッダー内で BatchHeaderValue プロパティを使用できます。

バッチを実行するには、レポート サーバー Web サービスの BatchHeaderValue プロパティに、バッチの作成時に生成されたバッチ ID の値を設定します。たとえば、次の C# コードでは、レポート サーバー Web サービスの BatchHeaderValue に以前作成したバッチ ID と同じ値を設定した後に、バッチを実行します。

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

バッチ ID の作成方法の詳細については、CreateBatch メソッドを参照してください。

使用例

次のコード例をコンパイルするには、Reporting Services の WSDL を参照し、特定の名前空間をインポートする必要があります。詳細については、「Compiling and Running Code Examples」を参照してください。次のコード例では、ユーザーの個人用レポート フォルダー内のアイテムの一覧を取得した後、バッチ操作を使用してアイテムを削除します。

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