Load SharePoint Server reports

To render SharePoint integrated SSRS reports set the ReportPath, ReportServiceURL, ReportServerUrl and ReportServerFormsCredential properties as in the following code snippet.

this.ReportViewer.ReportServiceURL = @"https://demos.boldreports.com/services/api/ReportViewer";
this.ReportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.ReportViewer.ReportServerFormsCredential = new BoldReports.UI.Xaml.ReportServerFormsCredential("ssrs", "RDLReport1");
this.ReportViewer.ReportPath = "http://<servername>/reportserver$instanceName/SSRSSamples/Territory Sales.rdl";
this.ReportViewer.RefreshReport();

Set data source credential for shared data sources

  1. The shared data source credentials can be added to the DataSourceCredentials property to connect with the database.

    this.ReportViewer.ReportServiceURL = @"https://demos.boldreports.com/services/api/ReportViewer";
    this.ReportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
    this.ReportViewer.ReportPath = "http://<servername>/reportserver$instanceName/SSRSSamples/Territory Sales.rdl";
    this.ReportViewer.RefreshReport();
  2. To set shared datasource credentials in Web API Controller, use the following code in the OnReportLoaded method.

    [NonAction]
    public void OnReportLoaded(ReportViewerOptions reportOption)
    {
         //Add ReportServerFormsCredential and data source credentials
        reportOption.ReportModel.ReportServerFormsCredential = new BoldReports.Web.ReportServerFormsCredential("ssrs", "RDLReport1");
        reportOption.ReportModel.DataSourceCredentials.Add(new BoldReports.Web.DataSourceCredentials("<database>", "ssrs1", "RDLReport1"));
    }

Data source credentials must be added for shared data sources that do not have credentials in the connection strings.