ReportingService2005.SetProperties(String, Property[]) Method


设置指定项的一个或多个属性。Sets one or more properties of a specified item.

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



项的完整路径名称。The full path name of the item.


一个 Property 对象的数组,该数组定义要为项设置的属性和属性值。An array of Property objects that defines the properties and values to set for the item.


若要编译下面的代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。To compile the following code example, you must reference the Reporting Services WSDL and import certain namespaces. 有关详细信息,请参阅 编译和运行代码示例For more information, see Compiling and Running Code Examples. 下面的代码示例为公司销售报表设置了新的说明:The following code example sets a new description for the Company Sales report:

Imports System  
Imports System.Web.Services.Protocols  

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

      Dim props(0) As [Property]  
      Dim setProp As New [Property]()  
      setProp.Name = "Description"  
      setProp.Value = "Sales by quarter and product category."  
      props(0) = setProp  

      Dim itemPath As String = "/SampleReports/Company Sales"  

         rs.SetProperties(itemPath, props)  
         Console.WriteLine("New description set on item {0}.", itemPath)  

      Catch ex As SoapException  
      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;  

      Property[] props = new Property[1];  
      Property setProp = new Property();  
      setProp.Name = "Description";  
      setProp.Value = "Sales by quarter and product category.";  
      props[0] = setProp;  

      string itemPath = "/SampleReports/Company Sales";   

         rs.SetProperties(itemPath, props);  
         Console.WriteLine("New description set on item {0}.", itemPath);  

      catch (SoapException ex)  


下表显示了有关此操作的标头和权限信息。The table below shows header and permissions information on this operation.

SOAP 标头SOAP Headers (In) BatchHeaderValue(In) BatchHeaderValue

(Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
所需的权限Required Permissions 取决于项类型:Depends on the item type:

- Folder: UpdateProperties- Folder: UpdateProperties
- Report: UpdateProperties- Report: UpdateProperties
- Resource: UpdateProperties- Resource: UpdateProperties
- DataSource: UpdateProperties- DataSource: UpdateProperties
- Model: UpdateProperties- Model: UpdateProperties

可以通过 Property 将对象作为方法参数传递来为项创建新的用户定义属性。You can create new user-defined properties for an item by passing a Property object as a method argument. 若要从项目中删除属性,请将属性设置为空值。To remove a property from an item, set the property to an empty value. 不能删除保留属性。You cannot remove reserved properties. 有关保留项属性的列表,请参阅 报表服务器项属性For a list of reserved item properties, see Report Server Item Properties.

如果调用方法时指定的属性不存在 SetProperties ,则将创建属性并将其设置为提供的值。If a specified property does not exist when the SetProperties method is called, the property is created and set to the value you supply. 如果该属性已存在,则将覆盖其值。If the property already exists, its value is overwritten. 对于不存在的属性,不会对该项或其属性设置空值。Setting an empty value for a property that does not exist has no effect on the item or its properties.

如果发生错误,则不设置任何属性。If an error occurs, no properties are set.

Applies to