
public class PortalItem : OnlineItem, ArcGIS.Desktop.Core.IMetadata, System.ComponentModel.INotifyPropertyChanged, System.ICloneable
Public Class PortalItem Inherits OnlineItem Implements ArcGIS.Desktop.Core.IMetadata, System.ComponentModel.INotifyPropertyChanged, System.ICloneable
// Creates an Item from an existing portal item base on its ID string portalItemID = "9801f878ff4a22738dff3f039c43e395"; Item portalItem = ItemFactory.Instance.Create(portalItemID, ItemFactory.ItemType.PortalItem);
// Creates an Item from an existing portal folder base on its ID string portalFolderID = "39c43e39f878f4a2279838dfff3f0015"; Item portalFolder = ItemFactory.Instance.Create(portalFolderID, ItemFactory.ItemType.PortalFolderItem);
var folderConnectionContent = projectfolderConnection.GetItems(); var folder = folderConnectionContent.FirstOrDefault(folderItem => folderItem.Name.Equals("Tourist Sites")); var folderContents = folder.GetItems();
//Basemaps stored locally in the project. This is usually an empty collection string localBasemapTypeID = "cim_map_basemap"; var localBasemaps = await QueuedTask.Run(() => { var mapContainer = Project.Current.GetProjectItemContainer("Map"); return mapContainer.GetItems().Where(i => i.TypeID == localBasemapTypeID).ToList(); }); //portal basemaps. If there is no current active portal, the usual default //is arcgis online var portal = ArcGISPortalManager.Current.GetActivePortal(); var portalBaseMaps = await portal.GetBasemapsAsync(); //use one of them...local or portal... //var map = MapView.Active.Map; //QueuedTask.Run(() => map?.SetBasemapLayers(portalBaseMaps[0]));
var portal = ArcGISPortalManager.Current.GetActivePortal(); var owner = portal.GetSignOnUsername(); var userContent = await portal.GetUserContentAsync(owner); //Get content for a specific folder (identified by its folder id) //var userContent = await portal.GetUserContentAsync(owner, folderId); //Get all the folders foreach (var pf in userContent.PortalFolders) { //Do something with the folders } //Get all the content items foreach (var pi in userContent.PortalItems) { //Do something with the portal items }
System.Object
ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
ArcGIS.Desktop.Core.Item
ArcGIS.Desktop.Core.Portal.OnlineItem
ArcGIS.Desktop.Core.Portal.PortalItem
Target Platforms: Windows 11, Windows 10