Execute a Report Binder (Advanced)
The following example executes a report binder, saves the output as a PDF file or Microsoft Word document and opens the file in the default document viewer.
- Connect to the reporting web service.
- Specify the file format as either "DOCX" or "PDF".
- Specify the unique identifier of the report binder to execute in GUID format.
- Specify the customer or container against which to execute the report binder, by default this is the root container with identifier 1000.
- Optionally set the report binder parameter values.
- The user must have permissions to execute this report binder.
Code Sample
# Set the file format to DOCX/PDF.
$fileformat = "DOCX";
$reportBinderIdentifier = [Guid]"0f22bce4-7428-4a11-84a5-9e23abfbcb71";
# Generate the execution settinsg.
$executionSettings = $reporting.DO_CreateReportBinderExecutionSettings($reportBinderIdentifier);
# Optionally set the customer or container.
$executionSettings.ContainerId = 1000;
# Execute the report binder.
$documentPackage = $reporting.DO_ExecuteReportBinder($executionSettings, $fileformat);
# Save and open the file.
$filename = "$($env:TEMP)\$($documentPackage.Filename)"
[IO.File]::WriteAllBytes($filename, $documentPackage.FileData);
[System.Diagnostics.Process]::Start($filename);
For information about setting report parameters see the Execute a Report (Advanced) example.