public IEnumerable<Item> GetItems()
Public Function GetItems() As IEnumerable(Of Item)
Return Value
Returns an enumerable collection of items
public IEnumerable<Item> GetItems()
Public Function GetItems() As IEnumerable(Of Item)
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"))); await QueuedTask.Run(() => { IEnumerable<Item> folderContents = folderConnection.GetItems(); });
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