ReportingService2010.GetItemParameters(String, String, Boolean, ParameterValue[], DataSourceCredentials[]) ReportingService2010.GetItemParameters(String, String, Boolean, ParameterValue[], DataSourceCredentials[]) 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.

public:
 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("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/GetItemParameters", 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 ReportService2010.ItemParameter[] GetItemParameters (string ItemPath, string HistoryID, bool ForRendering, ReportService2010.ParameterValue[] Values, ReportService2010.DataSourceCredentials[] Credentials);
Public Function GetItemParameters (ItemPath As String, HistoryID As String, ForRendering As Boolean, Values As ParameterValue(), Credentials As DataSourceCredentials()) As ItemParameter()
参数
ItemPath
String String String

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

HistoryID
String String String

项历史记录快照的 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(Nothing在 Visual Basic 中) 如果你在检索参数不是项历史记录快照的项。 Set the value to null (Nothing in Visual Basic) if you are retrieving parameters for an item that is not an item history snapshot.

ForRendering
Boolean Boolean Boolean

A 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.

Values
ParameterValue[]

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

Credentials
DataSourceCredentials[]

可用于验证查询参数的数据源凭据(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 服务 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  

      Try  
         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  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
      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;  

      try  
      {  
         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)  
      {  
         Console.WriteLine(e.Detail.InnerXml.ToString());   
      }  
   }  
}  

注解

下表显示了有关此操作的标头和权限信息。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.

适用于