ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Reports Namespace / ReportProjectItem Class
Members Example

In This Topic
    ReportProjectItem Class
    In This Topic
    Represents a report project item.
    Object Model
    ReportProjectItem ClassReport ClassTimeInstant Class
    Syntax
    Public NotInheritable Class ReportProjectItem 
       Inherits ArcGIS.Desktop.Internal.Core.ProjectItem
       Implements ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, System.ComponentModel.INotifyPropertyChanged 
    public sealed class ReportProjectItem : ArcGIS.Desktop.Internal.Core.ProjectItem, ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, System.ComponentModel.INotifyPropertyChanged  
    Remarks

    Each Report in a project is associated with a ReportProjectItem. This item contains numerous read-only metadata properties about the report. Although a report may exist in the project, it may not be loaded (an open report view). To reference the actual report and ensure it is loaded into memory, you must use the GetReport method.

    Example
    Gets all the reports in the current project
    {
      var reportsInProject = Project.Current.GetItems<ReportProjectItem>();
      foreach (var reportItem in reportsInProject)
      {
        //Do Something with the report
      }
    }
    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
    }
    Activate an already open report view
    {
      //Note: Needs QueuedTask to run
      Report reportToActivate = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault().GetReport();
      var reportPane = FrameworkApplication.Panes.FindReportPanes(report).Last();
      if (reportPane == null)
        return;
      //Activate the pane
      (reportPane as ArcGIS.Desktop.Framework.Contracts.Pane).Activate();
      //Get the "ReportView" associated with the Report Pane.
      ReportView reportViewFromPane = reportPane.ReportView;
    }
    Delete a report
    {
      //Note: Call within QueuedTask.Run()
      //Reference a ReportProjectItem in a project by name
      ReportProjectItem reportItem = Project.Current.GetItems<ReportProjectItem>().FirstOrDefault(item => item.Name.Equals(reportName));
      if (reportItem != null)
        //Delete the report from the project
        Project.Current.RemoveItem(reportItem);
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Core.Item
                ArcGIS.Desktop.Reports.ReportProjectItem

    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also