語言

ReportingService2005.GetProperties(String, Property[]) 方法

定義

回傳報告伺服器資料庫中一個或多個項目屬性的值。

public:
 cli::array <ReportService2005::Property ^> ^ GetProperties(System::String ^ Item, cli::array <ReportService2005::Property ^> ^ Properties);
public ReportService2005.Property[] GetProperties(string Item, ReportService2005.Property[] Properties);
member this.GetProperties : string * ReportService2005.Property[] -> ReportService2005.Property[]
Public Function GetProperties (Item As String, Properties As Property()) As Property()

參數

Item
String

完整路徑名稱或物品的識別碼。

Properties
Property[]

一個包含你想要取得數值屬性的物件陣列 Property 。

傳回

一個代表指定項目屬性的物件陣列 Property 。

範例

要編譯此程式碼範例,您必須參考 Reporting Services WSDL 並匯入特定命名空間。 欲了解更多資訊,請參閱編 譯與執行程式碼範例。 以下程式碼範例使用此 GetProperties 方法來取得與公司銷售報告相關的描述:

Imports System  
Imports System.Web.Services.Protocols  

Class Sample  
   Public Shared Sub Main()  
      Dim rs As New ReportingService2005()  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials  

      ' Create the property to retrieve.  
      Dim retrieveProp As New [Property]()  
      retrieveProp.Name = "Description"  
      Dim props(0) As [Property]  
      props(0) = retrieveProp  

      Try  
         Dim properties As [Property]() = rs.GetProperties("/SampleReports/Company Sales", props)  

         Dim prop As [Property]  
         For Each prop In  properties  
            ' Writes the description to the console.  
            Console.WriteLine(prop.Value)  
         Next prop  

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
      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;  

      // Create the property to retrieve.  
      Property retrieveProp = new Property();  
      retrieveProp.Name = "Description";  
      Property[] props = new Property[1];  
      props[0] = retrieveProp;  

      try  
      {  
         Property[] properties = rs.GetProperties("/SampleReports/Company Sales", props);  

         foreach (Property prop in properties)  
         {  
            // Writes the description to the console.  
            Console.WriteLine(prop.Value);  
         }  
      }  

      catch ( SoapException e )  
      {  
         Console.WriteLine( e.Detail.InnerXml.ToString() );  
      }  
   }  
}  

備註

下表顯示此操作的標頭與權限資訊。

SOAP 標頭 (在) ItemNamespaceHeaderValue

(出局) ServerInfoHeaderValue
必要權限 這取決於物品類型:

- Folder: ReadProperties
- Report: ReadProperties
- Resource: ReadProperties
- DataSource: ReadProperties
- Model: ReadProperties

此參數的預設值是完整的路徑名稱。 要提供 ID,必須設定 ItemNamespaceHeader SOAP 標頭。 更多資訊請參閱 GetProperties 方法的項目命名空間設定。

使用此 GetProperties 方法取得完整的使用者定義與保留屬性集合。 要取得保留屬性的標準子集,請使用該 ListChildren 方法。 關於報告伺服器資料庫中保留項目的屬性清單,請參見 報告伺服器項目屬性。

如果參數Properties為null(Nothing在 Visual Basic 中),則會回傳指定項目的所有屬性。 這些屬性包含所有使用者定義及內建的專屬屬性。

你可以傳遞項目的完整路徑名稱作為參數, Item 也可以傳遞項目的 ID。 欲了解更多使用 SOAP 標頭來達成此目的資訊,請參閱使用 Reporting Services SOAP 標頭。

適用於