ReportingService2005.BatchHeaderValue 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定代表 Reporting Services SOAP API 多方法操作的唯一系統產生批次 ID 的值(BatchHeaderValue物件)。
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
屬性值
批次標頭值。
範例
要編譯以下程式碼範例,您必須參考 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;
}
}
}
備註
你可以在 SOAP 標頭中使用這個 BatchHeaderValue 屬性來處理你想要批次處理的 Web 服務呼叫。
執行批次時,請將報表伺服器網路服務的屬性設定 BatchHeaderValue 為與批次建立時產生的批次 ID 相等的值。 例如,以下 C# 程式碼將報表伺服器網路服務的值設 BatchHeaderValue 為等於先前建立的批次 ID,然後執行批次:
rs.BatchHeaderValue = bh;
rs.ExecuteBatch();
欲了解更多關於建立批次 ID 的資訊,請參閱 CreateBatch 方法。