GetReportParameters 方法
返回指定报表的报表参数属性。GetReportParameters(String, String, Boolean, array<ParameterValue>[]()[][], array<DataSourceCredentials>[]()[][]) 方法还可用于根据指定报表的参数验证参数值。
命名空间: ReportService2006
程序集: ReportService2006(在 ReportService2006.dll 中)
语法
声明
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices/GetReportParameters", RequestNamespace := "https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices", _
ResponseNamespace := "https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("TrustedUserHeaderValue")> _
Public Function GetReportParameters ( _
Report As String, _
HistoryID As String, _
Values As ParameterValue(), _
Credentials As DataSourceCredentials() _
) As ReportParameter()
用法
Dim instance As ReportingService2006
Dim Report As String
Dim HistoryID As String
Dim Values As ParameterValue()
Dim Credentials As DataSourceCredentials()
Dim returnValue As ReportParameter()
returnValue = instance.GetReportParameters(Report, _
HistoryID, Values, Credentials)
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices/GetReportParameters", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("TrustedUserHeaderValue")]
public ReportParameter[] GetReportParameters(
string Report,
string HistoryID,
ParameterValue[] Values,
DataSourceCredentials[] Credentials
)
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices/GetReportParameters", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices",
ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices",
Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"TrustedUserHeaderValue")]
public:
array<ReportParameter^>^ GetReportParameters(
String^ Report,
String^ HistoryID,
array<ParameterValue^>^ Values,
array<DataSourceCredentials^>^ Credentials
)
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices/GetReportParameters", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices",
ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2006/03/15/reporting/reportingservices",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("TrustedUserHeaderValue")>]
member GetReportParameters :
Report:string *
HistoryID:string *
Values:ParameterValue[] *
Credentials:DataSourceCredentials[] -> ReportParameter[]
public function GetReportParameters(
Report : String,
HistoryID : String,
Values : ParameterValue[],
Credentials : DataSourceCredentials[]
) : ReportParameter[]
参数
- Report
类型:System. . :: . .String
报表的完全限定 URL,其中包括文件名和 .rdl 文件扩展名。
- HistoryID
类型:System. . :: . .String
报表历史记录快照的 ID。若要检索报表历史记录快照的参数属性,请将 ForRendering 参数设置为值 true。如果要检索某个报表的参数,而该报表不是报表历史记录快照,请将值设置为 nullNothingnullptrunitnull 引用(在 Visual Basic 中为 Nothing)(在 Visual Basic 中为 Nothing)。
- Values
类型:array<ReportService2006. . :: . .ParameterValue> [] () [] []
可以根据报表的参数进行验证的参数值(ParameterValue 对象)。
- Credentials
类型:array<ReportService2006. . :: . .DataSourceCredentials> [] () [] []
可用于验证查询参数的数据源凭据(DataSourceCredentials 对象)。
返回值
类型:array<ReportService2006. . :: . .ReportParameter> [] () [] []
ReportParameter 对象的数组,它列出报表的参数。
注释
The table below shows header and permissions information on this operation.
SOAP Headers |
(Out) ServerInfoHeaderValue |
Required Permissions |
ViewListItems()()()() |
If the execution setting for the report is Snapshot, the parameter metadata that is returned is the data that was used when the report history snapshot was created. If the execution setting for the report is Live, the parameter metadata returned represents the parameter data that is associated with the specified report.
If you provide a value for the HistoryID parameter and set the ForRendering parameter value to true, the parameter metadata returned represents the parameter data that was used when the report history snapshot was created. 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 report.
If 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 the credential information that is required to return the query parameters.
When using the GetReportParameters(String, String, Boolean, array<ParameterValue>[]()[][], array<DataSourceCredentials>[]()[][]) method to validate parameters, the Values parameter is required.
If report parameters do not exist for the given report, an empty ReportParameter array is returned.
示例
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;
string report = "http://<Server Name>/Docs/Documents" +
"/AdventureWorks Sample Reports/" +
"Employee Sales Summary.rdl";
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(report, historyID,
values, credentials);
if (parameters != null)
{
foreach (ReportParameter rp in parameters)
{
Console.WriteLine("Name: {0}", rp.Name);
}
}
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
}
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 report As String = "http://<Server Name>" + _
"/Docs/Documents/AdventureWorks Sample Reports" + _
"/Employee Sales Summary.rdl"
Dim historyID As String = Nothing
Dim values As ParameterValue() = Nothing
Dim credentials As DataSourceCredentials() = Nothing
Dim parameters As ReportParameter() = Nothing
Try
parameters = rs.GetReportParameters(report, historyID, _
values, credentials)
If Not (parameters Is Nothing) Then
Dim rp As ReportParameter
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
End Class