The following example executes a report, saves the output as a CSV file, 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 to execute in GUID format.

  • Optionally specify the customer or container against which to execute the report, by default this is the root container with identifier 1000.

  • The user must have permissions to execute this report.



Code Sample


# Set the file format to CSV/DOCX/PDF.

$fileformat = "DOCX";

$reportIdentifier = [Guid]"5413a609-80da-490b-ad76-104aa8d4021f";


# Execute the report.

$documentPackage = $reporting.DO_ExecuteReportBasic($reportIdentifier, $fileformat);


# Save and open the file.

$filename = "$($env:TEMP)\$($documentPackage.Filename)"

[IO.File]::WriteAllBytes($filename, $documentPackage.FileData);

[System.Diagnostics.Process]::Start($filename);