Public ReadOnly Property ProjectItemContainers As IEnumerable(Of Item)
public IEnumerable<Item> ProjectItemContainers {get;}
Public ReadOnly Property ProjectItemContainers As IEnumerable(Of Item)
public IEnumerable<Item> ProjectItemContainers {get;}
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 |
| Servers | ServerConnection | Server connections |
| Styles | Style | Styles |
| Tasks | Task | Tasks |
| Toolboxes | GP | Toolboxes |
| Workflows | WorkflowConnection | Workflows |
{
//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.
}
{
//Get the catalog pane
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);
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)