ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Reports Namespace / ReportProjectItem Class / GetReport Method
Example

In This Topic
    GetReport Method
    In This Topic
    Loads and returns the Report associated with the ReportProjectItem. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Report GetReport()
    Public Function GetReport() As Report

    Return Value

    Report
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Get a specific report
    ReportProjectItem reportProjItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals(reportName));
    Report report = reportProjItem?.GetReport();
    Open a Report project item in a new view
    //Open a report project item in a new view.
    //A report project item may exist but it may not be open in a view. 
    
    //Reference a report project item by name
    ReportProjectItem reportPrjItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals("MyReport"));
    
    //Get the report associated with the report project item
    Report reportToOpen = await QueuedTask.Run(() => reportPrjItem.GetReport());
    
    //Create the new pane
    IReportPane iNewReporttPane = await ProApp.Panes.CreateReportPaneAsync(reportToOpen); //GUI thread
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also