Corey Witherow
Corey Witherow

Reputation: 2472

Get Parameters from SSRS Report

I am trying to pull the parameters from an ssrs report. I have the following code.

var server = ConfigurationManager.AppSettings[WebConfigKeys.SSRSServer];

var protocol = ConfigurationManager.AppSettings[WebConfigKeys.SSRSProtocol];

var serverReport = new ServerReport
{
    ReportPath = $"{protocol}://{server}/ReportServer?/Reports/{report.ReportName}"
};

var parameters = serverReport.GetParameters();

once the app tries to do the serverReport.GetParameters() call it is generating the below error:

"The path of the item 'http://localhost/ReportServer?/Reports/PatientCareIncomplete/' is not valid. The full path must be less than 260 characters long; other restrictions apply. If the report server is in native mode, the path must start with slash."

What am I missing that needs to be there or what is causing this issue?

Upvotes: 0

Views: 1992

Answers (1)

D Stanley
D Stanley

Reputation: 152624

If I remember correctly you set the ReportServerUrl property to the root folder of your report server and set the ReportPath to the path relative to the root:

var serverReport = new ServerReport
{
    ReportServerUrl = $"{protocol}://{server}/ReportServer";
    ReportPath = $"/Reports/{report.ReportName}";
};

Upvotes: 1

Related Questions