ReportingService2006.SetProperties Method

Sets one or more properties of a specified item.

命名空間: ReportService2006
組件: ReportService2006 (in reportservice2006.dll)

語法

'宣告
Public Sub SetProperties ( _
    Item As String, _
    Properties As Property() _
)
public void SetProperties (
    string Item,
    Property[] Properties
)
public:
void SetProperties (
    String^ Item, 
    array<Property^>^ Properties
)
public void SetProperties (
    String Item, 
    Property[] Properties
)
public function SetProperties (
    Item : String, 
    Properties : Property[]
)

參數

  • Item
    The fully qualified URL of the item including the file name and extension.
  • Properties
    An array of Property objects that defines the properties and values to set for the item.

備註

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.

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.

Returns rsOperationNotSupportedSharePointMode error when 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)
    {
        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

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Server 2008, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional with Service Pack 2 (SP2), Windows 2000 Professional, Windows 2000 Advanced Server, Windows XP Home Edition, 如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。, Windows Vista, Windows Mobile 5.0, Windows Mobile 2003 for Pocket PC, Windows CE 5.0

請參閱

參考

ReportingService2006 Class
ReportingService2006 Members
ReportService2006 Namespace