How to get container type from catalog selected item

05-09-2021 08:48 PM
by Anonymous User
Not applicable

Hi Gurus,


I have a trouble getting container type from selected item (sde connection).

As you know sde connection can be from Folder connection(Folders) or GDB connection (Databases) in Catalog pane.


Let say I retrieve selected sde connection with 


ArcGIS.Desktop.Core.IProjectWindow currentProjectWindow = Project.GetCatalogPane(true);

var selectedItem = currentProjectWindow.SelectedItem.First();


How shall I know that selectedItem's parent container is Folders or Databases?


I am using Pro sdk 2.7 at the moment.

@Wolf @UmaHarano ?

Tags (1)
0 Kudos
4 Replies
Esri Regular Contributor


You could cast the SelectedItem to the Type you are interested in.

ArcGIS.Desktop.Core.IProjectWindow currentProjectWindow = Project.GetCatalogPane(true);
var selectedItem = currentProjectWindow.SelectedItems.FirstOrDefault();
var folderConnection = selectedItem as MapProjectItem;  //FolderConnectionProjectItem, etc




0 Kudos
by Anonymous User
Not applicable

Thank for your reply @UmaHarano ,

Look like my question is not clear, 

For type casting from project item, to find the specific type and casting is ok for me, not an issue.

Refer to below example screenshot. for BrowseProject.sde item, user can choose from Databases or Folders. I have a specific analysis requirement whether user more frequently use this sde connection from Database container or Folders container.

So after user select the item, I need to find out, which container is the origin. 


Best Regards,


0 Kudos
Occasional Contributor


    I hope this will help.

1. create project using MapTool.

2. in the constructor,

public CaptureContainer()
IsSketchTool = true;
SketchType = SketchGeometryType.Point; //.Point;
//UseSnapping = true;
SketchOutputMode = SketchOutputMode.Screen;
var systemCursor = System.Windows.Input.Cursors.Arrow; 
Cursor = systemCursor;


protected async override Task<bool> OnSketchCompleteAsync(Geometry geometry)

await QueuedTask.Run(() =>
var sourceSelection = ActiveMapView.SelectFeatures(geometry, SelectionCombinationMethod.New);

foreach (KeyValuePair<BasicFeatureLayer, List<long>> eachSel in sourceSelection)
CIMDataConnection currentDataConnection = eachSel.Key.GetDataConnection();
var objsting= currentDataConnection.ToJson();
JObject jsonObject = JObject.Parse(objsting);
MessageBox.Show("connection string is from : "+(string)jsonObject["workspaceFactory"]);
return true;

Hope this helps. 




0 Kudos
by Anonymous User
Not applicable

Thank @SreenivasaRaoPigili ,

But It is not what I am looking for actually.

Refer to my image: The first project item , it's parent container is databases, and second project item, it's parent container is folder connection (folders). in the catalog pane.

First item parent object should be like


Second item parent object should be like


Currently I can't figure out from selected project item (selected item), something like which property to use.

0 Kudos