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¶
- Sets
m_RS.Credentials = System.Net.CredentialCache.DefaultCredentials(Windows-integrated authentication to the SSRS SOAP endpoint).* - Calls
m_RS.LoadReport2(ReportPath, HistoryID)—HistoryIDis 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 atReportPathand returnsExecutionInfo2.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.* - If parameters were added via Add or clear SSRS report parameters, builds a
SharepointReporting.ParameterValue()array (BuildParameters) from the internalNameValueCollectionand callsm_RS.SetExecutionParameters(...). - Calls
m_RS.Render2(m_Format, devinfo, PageCountMode.Actual, m_Extension, encoding, mimeType, Warnings, streamIDs)to render the report in the selectedFormat/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.*
HistoryIDis deliberately left empty; passing a value reportedly causes the call to fail with an invalidSnapshotIdper an inline code comment.
Related documentation¶
Sources¶
SAIF.Services.Printing\clsRSPrint.vbSAIF.Services.Printing\Web References\SharepointReporting\Reference.vb