ReportingService2005.BatchHeaderValue 屬性

定義

取得或設定值, (BatchHeaderValue 物件) ,此值代表 REPORTING SERVICES SOAP API 中多重方法作業的唯一、系統產生的批次識別碼。

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

屬性值

BatchHeader

批次標頭值。

範例

若要編譯下列程式碼範例,您必須參考 Reporting Services WSDL 並匯入特定命名空間。 如需詳細資訊,請參閱 編譯和執行程式碼範例。 下列程式碼範例會取出使用者的我的報表資料夾中的專案清單,然後使用批次作業來刪除專案:

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

備註

您可以在 BatchHeaderValue SOAP 標頭中,針對您想要批次處理的 Web 服務呼叫使用屬性。

若要執行批次,請將 BatchHeaderValue 報表伺服器 Web 服務的屬性設為等於建立批次時所產生之批次識別碼的值。 例如,下列 c # 程式碼會將 BatchHeaderValue 報表伺服器 Web 服務的設為等於先前建立之批次識別碼的值,然後執行批次:

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

如需有關建立批次識別碼的詳細資訊,請參閱 CreateBatch 方法。

適用於