Share via


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

项的完整路径名或 ID。

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 标头 (In) ItemNamespaceHeaderValue

(Out) ServerInfoHeaderValue
所需的权限 取决于项类型:

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

必须为此参数传递的默认值是完整路径名称。 若要提供 ID,必须设置 ItemNamespaceHeader SOAP 标头。 有关详细信息,请参阅 设置 GetProperties 方法的项命名空间

GetProperties使用 方法检索完整的用户定义的属性和保留属性集。 若要检索保留属性的标准子集,请使用 ListChildren 方法。 有关报表服务器数据库中项的保留属性的列表,请参阅 报表服务器项属性

Properties如果在 Visual Basic) Nothing 中 (参数null,则返回指定项的所有属性。 其中包括特定于项的所有用户定义和内置属性。

可以传递参数项的完整路径名称, Item 也可以传递项的 ID。 有关使用 SOAP 标头完成此操作的详细信息,请参阅 Using Reporting Services SOAP Headers

适用于