ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Desktop.Core Namespace / Project Class / ProjectItemContainers Property
Example

In This Topic
    ProjectItemContainers Property
    In This Topic
    Gets the list of project item containers
    Syntax
    public IEnumerable<Item> ProjectItemContainers {get;}
    Public ReadOnly Property ProjectItemContainers As IEnumerable(Of Item)

    Property Value

    The list of containers as IEnumerable
    Remarks
    The project item containers correspond to the catalog pane nodes on the "Project Tab" and their counterparts on catalog views. A container is needed only in those situations where you want to select a specific item that occurs in more than one container.

    The list of containers can vary depending on the content within a given project. Some containers that are instantiated in one project can be null in others

    Containers also include non-visible internal containers. These can be ignored.

    Public containers (not including any 3rd party custom containers):

    Display Name(English) Path or "Key" (Non-localizable) Item content
    Databases GDB Database content
    Folders FolderConnection Files and Folders
    Layouts Layout Layouts
    Locators LocatorsConnection Locators
    Maps Map Maps
    Raster Function Templates RasterFunctionTemplates Raster function templates
    Reviewer Batch Jobs DataReviewerBatchJobs Reviewer batch jobs
    Reviewer Results DataReviewerResources Reviewer results
    Servers ServerConnection Server connections
    Styles Style Styles
    Tasks Task Tasks
    Toolboxes GP Toolboxes
    Workflows WorkflowConnection Workflows
    Example
    Select project containers - for use with SelectItemAsync
    //Use Project.Current.ProjectItemContainers
    var folderContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "FolderConnection");
    var gdbContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "GDB");
    var mapContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "Map");
    var layoutContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "Layout");
    var toolboxContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "GP");
    //etc.
    
    //or...use Project.Current.GetProjectItemContainer
    
    folderContainer = Project.Current.GetProjectItemContainer("FolderConnection");
    gdbContainer = Project.Current.GetProjectItemContainer("GDB");
    mapContainer = Project.Current.GetProjectItemContainer("Map");
    layoutContainer = Project.Current.GetProjectItemContainer("Layout");
    toolboxContainer = Project.Current.GetProjectItemContainer("GP");
    //etc.
    
    Select an item in the Catalog pane
    //Get the catalog pane
    ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetCatalogPane();
    //or get the active catalog view...
    //ArcGIS.Desktop.Core.IProjectWindow projectWindow = Project.GetActiveCatalogWindow();
    
    //eg Find a toolbox in the project
    string gpName = "Interacting with Maps.tbx";
    var toolbox = Project.Current.GetItems<GeoprocessingProjectItem>().FirstOrDefault(tbx => tbx.Name == gpName);
    //Select it under Toolboxes
    projectWindow.SelectItemAsync(toolbox, true, true, null);//null selects it in the first container - optionally await
                                                             //Note: Project.Current.GetProjectItemContainer("GP") would get toolbox container...
    
    //assume toolbox is also under Folders container. Select it under Folders instead of Toolboxes
    var foldersContainer = Project.Current.ProjectItemContainers.First(c => c.Path == "FolderConnection");
    //We must specify the container because Folders comes second (after Toolboxes)
    projectWindow.SelectItemAsync(toolbox, true, true, foldersContainer);//optionally await
    
    //Find a map and select it
    var mapItem = Project.Current.GetItems<MapProjectItem>().FirstOrDefault(m => m.Name == "Map");
    //Map only occurs under "Maps" so the container need not be specified
    projectWindow.SelectItemAsync(mapItem, true, false, null);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also