Browses the contents of an item.
Returns a snapshot collection of of the item's children.
This method must be called on the MCT. Use QueuedTask.Run.
Return Value
Returns an enumerable collection of items
Get Project Items by ProjectItem type
/// Get all the items that can be accessed from a folder connection. The items immediately
/// contained by a folder, that is, the folder's children, are returned including folders
/// and individual items that can be used in ArcGIS Pro. This method does not return all
/// items contained by any sub-folder that can be accessed from the folder connection.
FolderConnectionProjectItem folderConnection = Project.Current.GetItems<FolderConnectionProjectItem>()
.FirstOrDefault((folder => folder.Name.Equals("Data")));
await QueuedTask.Run(() =>
{
IEnumerable<Item> folderContents = folderConnection.GetItems();
});
Obtaining Geodatabase from Project Item
public async Task ObtainingGeodatabaseFromProjectItem()
{
IEnumerable<GDBProjectItem> gdbProjectItems = Project.Current.GetItems<GDBProjectItem>();
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
foreach (GDBProjectItem gdbProjectItem in gdbProjectItems)
{
using (Datastore datastore = gdbProjectItem.GetDatastore())
{
//Unsupported datastores (non File GDB and non Enterprise GDB) will be of type UnknownDatastore
if (datastore is UnknownDatastore)
continue;
Geodatabase geodatabase = datastore as Geodatabase;
// Use the geodatabase.
}
}
});
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.