ReportingService2010.SetProperties(String, Property[]) ReportingService2010.SetProperties(String, Property[]) ReportingService2010.SetProperties(String, Property[]) Method

定义

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

public:
 void SetProperties(System::String ^ ItemPath, cli::array <ReportService2010::Property ^> ^ Properties);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/SetProperties", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public void SetProperties (string ItemPath, ReportService2010.Property[] Properties);
Public Sub SetProperties (ItemPath As String, Properties As Property())
参数
ItemPath
String String String

项的完全限定 URL,其中包括文件名(在 SharePoint 模式下,还有扩展名)。 The fully qualified URL of the item including the file name and, in SharePoint mode, the extension.

Properties
Property[]

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

示例

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)  
    {  
        ReportingService2010 rs = new ReportingService2010();  
        rs.Url = "http://<Server Name>/_vti_bin/ReportServer/" +  
            "ReportService2010.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 ReportingService2010()  
        rs.Url = "http://<Server Name>/_vti_bin/ReportServer/" + _  
            "ReportService2010.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  

注解

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

SOAP 标头使用情况SOAP Header Usage (In) TrustedUserHeaderValue(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
纯模式所需的权限Native Mode 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
SharePoint 模式所需的权限SharePoint Mode Required Permissions EditListItems

可以通过创建新用户定义的属性,其中的某个项目的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 that you supply. 如果属性已存在,其值将被覆盖。If the property already exists, its value is overwritten. 设置一个属性,不存在的空值不会影响的项目或其属性。Setting an empty value for a property that does not exist does not affect the item or its properties.

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

返回rsOperationNotSupportedSharePointMode错误时项 ="/"。Returns rsOperationNotSupportedSharePointMode error when Item=”/”.

适用于