ReportingService2006.GetReportParameters Method

Definition

Returns report parameter properties for a specified report. The GetReportParameters(String, String, ParameterValue[], DataSourceCredentials[]) method can also be used to validate parameter values against parameters for a specified report.

public:
 cli::array <ReportService2006::ReportParameter ^> ^ GetReportParameters(System::String ^ Report, System::String ^ HistoryID, cli::array <ReportService2006::ParameterValue ^> ^ Values, cli::array <ReportService2006::DataSourceCredentials ^> ^ Credentials);
public ReportService2006.ReportParameter[] GetReportParameters (string Report, string HistoryID, ReportService2006.ParameterValue[] Values, ReportService2006.DataSourceCredentials[] Credentials);
member this.GetReportParameters : string * string * ReportService2006.ParameterValue[] * ReportService2006.DataSourceCredentials[] -> ReportService2006.ReportParameter[]
Public Function GetReportParameters (Report As String, HistoryID As String, Values As ParameterValue(), Credentials As DataSourceCredentials()) As ReportParameter()

Parameters

Report
String

The fully qualified URL of the report including the file name and .rdl file name extension.

HistoryID
String

The ID of the report history snapshot. Set the ForRendering parameter to a value of true in order to retrieve parameter properties for a report history snapshot. Set the value to null (Nothing in Visual Basic) if you are retrieving parameters for a report that is not a report history snapshot.

Values
ParameterValue[]

The parameter values (ParameterValue objects) that can be validated against the parameters of a report.

Credentials
DataSourceCredentials[]

The data source credentials (DataSourceCredentials objects) that can be used to validate query parameters.

Returns

An array of ReportParameter objects that lists the parameters for the report.

Examples

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  

Remarks

The table below shows header and permissions information on this operation.

SOAP Headers (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
Required Permissions <xref:Microsoft.SharePoint.SPBasePermissions.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 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.

Applies to