ArcGIS Pro 3.7 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 Function GetReport() As Report
    public Report GetReport()

    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("Report Name"));
      //Note: Needs QueuedTask to run
      Report reportInProject = 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
      //Note: Needs QueuedTask to run
      Report reportToOpen = reportPrjItem.GetReport();
    
      //Create the new pane
      IReportPane iNewReportPane = await ProApp.Panes.CreateReportPaneAsync(reportToOpen); //GUI thread
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also