file geodatabase path

09-19-2018 02:40 PM
by Anonymous User
Not applicable

I'm using Pro SDK 2.0 and have a geodatabase object for a file geodatabase. I'd like to get the file path of the geodatabase but haven't been able to figure out how?

0 Kudos
2 Replies
MVP Emeritus

trying out the sdk help files... but I probably have the wrong one...

ArcGIS Pro 2.2 API Reference Guide or

ArcGIS Pro 2.2 API Reference Guide 

FileGeodatabaseConnectionPath Class

Represents the physical path to a file geodatabase folder that ends with the .gdb extension.

0 Kudos
by Esri Regular Contributor
Esri Regular Contributor

Here is a snippet that explains how to get the path:

QueuedTask.Run(() =>
         using (Geodatabase defaultGeodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(Project.Current.DefaultGeodatabasePath))))
           FileGeodatabaseConnectionPath connectionPath = (FileGeodatabaseConnectionPath)defaultGeodatabase.GetConnector();
           MessageBox.Show($@"Path: {connectionPath.Path}");

You can paste this into the OnClick of a button Add-in to test it out.

Hope this helps,