Skip to content

Render an SSRS report

Loads a report definition from SQL Server Reporting Services, applies any configured parameters, and renders it to bytes in the selected output format.

Field Value
Operation ID OP-RSPRINT-RENDER
Trigger Caller invokes clsRSPrint.PreviewDocument()
Inputs ReportPath, parameters added via Add or clear SSRS report parameters, Format/Extension
Outputs Rendered report bytes in the selected format
Primary components clsRSPrint.PreviewDocument, clsRSPrint.BuildParameters
Entry point SAIF.Services.Printing\clsRSPrint.vb

Steps

  1. Sets m_RS.Credentials = System.Net.CredentialCache.DefaultCredentials (Windows-integrated authentication to the SSRS SOAP endpoint).*
  2. Calls m_RS.LoadReport2(ReportPath, HistoryID) — HistoryID is deliberately left uninitialized/empty per an inline code comment ("don't initialize historyid — it makes the call fail with invalid SnapshotId") — loads the report definition at ReportPath and returns ExecutionInfo2.

    Origin: This step is implemented in SharepointReporting.ReportExecutionService (SAIF.Services.Printing.SharepointReporting, auto-generated SOAP client proxy) and executed against the external SSRS report server.*

  3. If parameters were added via Add or clear SSRS report parameters, builds a SharepointReporting.ParameterValue() array (BuildParameters) from the internal NameValueCollection and calls m_RS.SetExecutionParameters(...).
  4. Calls m_RS.Render2(m_Format, devinfo, PageCountMode.Actual, m_Extension, encoding, mimeType, Warnings, streamIDs) to render the report in the selected Format/Extension, returning the rendered bytes.

Process flow

flowchart TD
    Start([PreviewDocument called]) --> SetCreds[Set DefaultCredentials]
    SetCreds --> Load[Call LoadReport2 with ReportPath]
    Load --> HasParams{Parameters added?}
    HasParams -->|Yes| SetParams[BuildParameters and SetExecutionParameters]
    HasParams -->|No| Render
    SetParams --> Render[Call Render2]
    Render --> Return([Return rendered bytes])

Failure and edge-case behavior

  • SSRS executes the report's own data-source queries server-side, outside this library's visibility; no SQL/table interaction occurs in this library's own code.*
  • HistoryID is deliberately left empty; passing a value reportedly causes the call to fail with an invalid SnapshotId per an inline code comment.

Sources

  • SAIF.Services.Printing\clsRSPrint.vb
  • SAIF.Services.Printing\Web References\SharepointReporting\Reference.vb