ReportingService2005.BatchHeaderValue 属性

定义

获取或设置对象) (BatchHeaderValue 值,该值表示Reporting Services SOAP API 中多方法操作的唯一系统生成的批处理 ID。

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

注解

可以对要批处理的 Web 服务调用使用 BatchHeaderValue SOAP 标头中的 属性。

若要执行批处理,请将报表服务器 Web 服务的 属性设置为 BatchHeaderValue 等于创建批处理时生成的批 ID 的值。 例如,以下 C# 代码将报表服务器 Web 服务的 设置为 BatchHeaderValue 等于以前创建的批处理 ID 的值,然后执行批处理:

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

有关创建批处理 ID 的详细信息,请参阅 CreateBatch 方法。

适用于