ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.GeoProcessing Namespace / GeoprocessingProjectItem Class
Members Example

In This Topic
    GeoprocessingProjectItem Class
    In This Topic
    Represents a GeoProcessing project item.
    Object Model
    GeoprocessingProjectItem ClassIGPItemInfo InterfaceTimeInstant Class
    Syntax
    Public NotInheritable Class GeoprocessingProjectItem 
       Inherits ArcGIS.Desktop.Internal.Catalog.ItemInfo
       Implements ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, ArcGIS.Desktop.Core.ISearchableItem, System.ComponentModel.INotifyPropertyChanged 
    public sealed class GeoprocessingProjectItem : ArcGIS.Desktop.Internal.Catalog.ItemInfo, ArcGIS.Desktop.Core.IMetadata, ArcGIS.Desktop.Core.IProjectItem, ArcGIS.Desktop.Core.ISearchableItem, System.ComponentModel.INotifyPropertyChanged  
    Example
    Get a specific GeoprocessingProjectItem
    {
      //Gets a specific GeoprocessingProjectItem in the current project
      // example: "myToolbox" is the name of the GeoprocessingProjectItem
      GeoprocessingProjectItem gpProjItem = Project.Current.GetItems<GeoprocessingProjectItem>().FirstOrDefault(item => item.Name.Equals("myToolbox"));
      // Use gpProjItem;
    }
    Get all GeoprocessingProjectItems in a project
    {
      //Gets all the GeoprocessingProjectItem in the current project
      var GPItems = Project.Current.GetItems<GeoprocessingProjectItem>();
      foreach (var tbx in GPItems)
      {
        //Do Something with the toolbox
      }
    }
    Get Geoprocessing project items
    {
      var gpItems = CoreModule.CurrentProject.Items.OfType<GeoprocessingProjectItem>();
    
      // go through all the available toolboxes
      foreach (var gpItem in gpItems)
      {
        var itemsInsideToolBox = gpItem.GetItems();
    
        // then for each toolbox list the tools inside
        foreach (var toolItem in itemsInsideToolBox)
        {
          string newTool = string.Join(";", [toolItem.Path, toolItem.Name]);
          // do something with the newTool
          // for example, add to a list to track or use them later
        }
      }
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Core.Item
                ArcGIS.Desktop.GeoProcessing.GeoprocessingProjectItem

    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also