ReportingService2006.SetProperties(String, Property[]) 方法

定义

设置指定项的一个或多个属性。

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

参数

Item
String

项的完全限定 URL,其中包括文件名和扩展名。

Properties
Property[]

一个 Property 对象的数组,该数组定义要为项设置的属性和属性值。

示例

using System;  
using System.Collections.Generic;  
using System.IO;  
using System.Text;  
using System.Web;  
using System.Web.Services;  
using System.Web.Services.Protocols;  

class Sample  
{  
    static void Main(string[] args)  
    {  
        ReportingService2006 rs = new ReportingService2006();  
        rs.Url = "http://<Server Name>/_vti_bin/ReportServer/" +  
            "ReportService2006.asmx";  
        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 = "http://<Server Name>/Docs/Documents/" +  
            "AdventureWorks Sample Reports/Sales Order Detail.rdl";  

        try  
        {  
            rs.SetProperties(itemPath, props);  
            Console.WriteLine("New description set on item {0}.",   
                itemPath);  
        }  
        catch (SoapException ex)  
        {  
            Console.WriteLine(ex.Detail.OuterXml);  
        }  
    }  
}  
Imports System  
Imports System.IO  
Imports System.Text  
Imports System.Web.Services  
Imports System.Web.Services.Protocols  

Class Sample  

    Public Shared Sub Main()  

        Dim rs As New ReportingService2006()  
        rs.Url = "http://<Server Name>/_vti_bin/ReportServer/" + _  
            "ReportService2006.asmx"  
        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 = "http://<Server Name>/Docs/" + _  
            "Documents/AdventureWorks Sample Reports/" + _  
            "Sales Order Detail.rdl"  

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

        Catch ex As SoapException  
            Console.WriteLine(ex.Detail.OuterXml)  
        End Try  

    End Sub  

End Class  

注解

下表显示了有关此操作的标头和权限信息。

SOAP 标头 (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
所需的权限 <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems>

可以通过将 对象作为方法参数传递 Property 来为项创建新的用户定义属性。 若要从项中删除属性,请将 属性设置为空值。 不能删除保留的属性。 有关保留项属性的列表,请参阅 报表服务器项属性

如果在调用 方法时 SetProperties 不存在指定的属性,则会创建该属性并将其设置为你提供的值。 如果该属性已存在,则其值将被覆盖。 为不存在的属性设置空值不会影响项或其属性。

如果发生错误,则不设置任何属性。

rsOperationNotSupportedSharePointMode当 Item=“/”时返回错误。

适用于