ReportingService2005.SetProperties(String, Property[]) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定指定項目的一個或多個屬性。
public:
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())
參數
- Item
- String
物品的完整路徑名稱。
範例
要編譯以下程式碼範例,您必須參考 Reporting Services WSDL 並匯入特定命名空間。 欲了解更多資訊,請參閱編 譯與執行程式碼範例。 以下程式碼範例為公司銷售報告設定了新的描述:
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"
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 '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";
try
{
rs.SetProperties(itemPath, props);
Console.WriteLine("New description set on item {0}.", itemPath);
}
catch (SoapException ex)
{
Console.WriteLine(ex.Detail.OuterXml);
}
}
}
備註
下表顯示此操作的標頭與權限資訊。
| SOAP 標頭 | (在) BatchHeaderValue (出局) ServerInfoHeaderValue |
| 必要權限 | 這取決於物品類型: - Folder: UpdateProperties- Report: UpdateProperties- Resource: UpdateProperties- DataSource: UpdateProperties- Model: UpdateProperties |
你可以透過傳遞 Property 物件作為方法參數來建立新的使用者自訂屬性。 要移除某個屬性,請將該屬性設為空值。 你無法移除保留房產。 關於保留項目屬性的清單,請參見 「報告伺服器項目屬性」。
如果在呼叫該方法時 SetProperties 指定的屬性不存在,該屬性會被建立並設定為你提供的值。 如果該財產已經存在,其價值會被覆蓋。 對不存在的屬性設定空值,對該物品或其屬性沒有影響。
若發生錯誤,則不會設定任何屬性。