Public Function GetItems() As IEnumerable(Of Item)
public IEnumerable<Item> GetItems()
Return Value
Returns an enumerable collection of items
Public Function GetItems() As IEnumerable(Of Item)
public IEnumerable<Item> GetItems()
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
For example, returns a list of all the feature datasets, feature classes, tables and so on within a database. Or, returns a list of all the subfolders and other items within a folder.
{
// 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"));
//Note: Needs QueuedTask to run
IEnumerable<Item> folderContents = folderConnection.GetItems();
}
{
await QueuedTask.Run(() =>
{
IEnumerable<GDBProjectItem> gdbProjectItems = Project.Current.GetItems<GDBProjectItem>();
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 Home, Pro, Enterprise (64 bit)