ReportingService2010.GetItemParameters(String, String, Boolean, ParameterValue[], DataSourceCredentials[]) Method


返回指定项的参数属性。此方法还可用于验证指定项的参数值。Returns parameter properties for a specified item.This method can also be used to validate parameter values against parameters for a specified item.

 cli::array <ReportService2010::ItemParameter ^> ^ GetItemParameters(System::String ^ ItemPath, System::String ^ HistoryID, bool ForRendering, cli::array <ReportService2010::ParameterValue ^> ^ Values, cli::array <ReportService2010::DataSourceCredentials ^> ^ Credentials);
[System.Web.Services.Protocols.SoapDocumentMethod("", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="", ResponseNamespace="", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public ReportService2010.ItemParameter[] GetItemParameters (string ItemPath, string HistoryID, bool ForRendering, ReportService2010.ParameterValue[] Values, ReportService2010.DataSourceCredentials[] Credentials);
[<System.Web.Services.Protocols.SoapDocumentMethod("", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="", ResponseNamespace="", Use=System.Web.Services.Description.SoapBindingUse.Literal)>]
[<System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
member this.GetItemParameters : string * string * bool * ReportService2010.ParameterValue[] * ReportService2010.DataSourceCredentials[] -> ReportService2010.ItemParameter[]
Public Function GetItemParameters (ItemPath As String, HistoryID As String, ForRendering As Boolean, Values As ParameterValue(), Credentials As DataSourceCredentials()) As ItemParameter()



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


项历史记录快照的 ID。The ID of the item history snapshot. ForRendering 参数设置为值,以便 true 检索项历史记录快照的参数属性。Set the ForRendering parameter to a value of true in order to retrieve parameter properties for an item history snapshot. 如果要检索某个项的参数,而该项不是项历史记录快照,请将值设置为 null(在 Visual Basic 中为 Nothing)。Set the value to null (Nothing in Visual Basic) if you are retrieving parameters for an item that is not an item history snapshot.


一个指示将如何使用参数值的Boolean表达式。A Boolean expression that indicates how the parameter values are to be used. 如果设置为值 true,则返回的参数属性基于项执行期间使用的参数数据。If set to a value of true, parameter properties that are returned are based on the parameter data that was used during the execution of the item.


参数值(ParameterValue 对象),可以根据报表服务器管理的项的参数来验证这些参数值。The parameter values (ParameterValue objects) that can be validated against the parameters of an item that is managed by the report server.


可用于验证查询参数的数据源凭据(DataSourceCredentials 对象)。The data source credentials (DataSourceCredentials objects) that can be used to validate query parameters.



一个 ItemParameter 对象的数组,该数组列出项的参数。An array of ItemParameter objects that lists the parameters for the item.



若要编译此代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. 有关详细信息,请参阅 编译和运行代码示例For more information, see Compiling and Running Code Examples. 下面的代码示例使用 GetItemParameters 方法检索报表的参数元数据列表,然后显示每个参数的名称:The following code example uses the GetItemParameters method to retrieve a list of parameter metadata for a report and then displays the name of each parameter:

Imports System  
Imports System.Web.Services.Protocols  

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

      Dim report As String = "/SampleReports/Employee Sales Summary"  
      Dim forRendering As Boolean = False  
      Dim historyID As String = Nothing  
      Dim values As ParameterValue() = Nothing  
      Dim credentials As DataSourceCredentials() = Nothing  
      Dim parameters As ItemParameter() = Nothing  

         parameters = rs.GetItemParameters(report, historyID, forRendering, values, credentials)  

         If Not (parameters Is Nothing) Then  
            Dim rp As ItemParameter  
            For Each rp In parameters  
               Console.WriteLine("Name: {0}", rp.Name)  
            Next rp  
         End If  

      Catch e As SoapException  
      End Try  
   End Sub 'Main  
End Class 'Sample  
using System;  
using System.Web.Services.Protocols;  

class Sample  
   public static void Main()  
      ReportingService2010 rs = new ReportingService2010();  
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;  

      string report = "/SampleReports/Employee Sales Summary";  
      bool forRendering = false;  
      string historyID = null;  
      ParameterValue[] values = null;  
      DataSourceCredentials[] credentials = null;  
      ItemParameter[] parameters = null;  

         parameters = rs.GetItemParameters(report, historyID, forRendering, values, credentials);  

         if (parameters != null)  
            foreach (ItemParameter rp in parameters)  
               Console.WriteLine("Name: {0}", rp.Name);  

      catch (SoapException e)  


下表显示了有关此操作的标头和权限信息。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 ReadProperties
SharePoint 模式所需的权限SharePoint Mode Required Permissions ViewListItems

如果项的执行设置为,则 Snapshot 返回的参数元数据是创建项历史记录快照时使用的数据。If the execution setting for the item is Snapshot, the parameter metadata that is returned is the data that was used when the item history snapshot was created. 如果项的执行设置为,则 Live 返回的参数元数据表示与指定项关联的参数数据。If the execution setting for the item is Live, the parameter metadata returned represents the parameter data that is associated with the specified item.

如果为参数提供一个值 HistoryID 并将 ForRendering 参数值设置为 true ,则返回的参数元数据表示在创建项历史记录快照时使用的参数数据。If you provide a value for the HistoryID parameter and set the ForRendering parameter value totrue, the parameter metadata returned represents the parameter data that was used when the item history snapshot was created. 如果设置为,则将忽略为提供的值 HistoryID ForRendering false 。如果 ForRenderingfalse ,则返回的参数元数据表示当前与指定项关联的参数数据。The value supplied for HistoryID is ignored if ForRendering is set to false.If ForRendering is false, the parameter metadata returned represents the parameter data that is currently associated with the specified item.

如果任何参数值基于查询,并且您有兴趣返回基于查询的参数的有效值列表,则将设置 ForRenderingtrueIf any parameters values are based on a query and you are interested in returning the query-based parameters' valid values list, set ForRendering to true. 此外,对于基于查询的参数,必须传入返回查询参数所需的所有凭据信息。In addition, for query-based parameters, you must pass in all of the credential information required to return the query parameters.

使用 GetItemParameters 方法验证参数时, Values 参数是必需的。When using the GetItemParameters method to validate parameters, the Values parameter is required.

如果给定项的参数不存在, ItemParameter 则返回空数组。If parameters do not exist for the given item, an empty ItemParameter array is returned.

Applies to