var active_portal = ArcGISPortalManager.Current.GetActivePortal(); string uri = active_portal.PortalUri.ToString();
var portals = ArcGISPortalManager.Current.GetPortals(); //Make a list of all the Uris var portalUris = portals.Select(p => p.PortalUri.ToString()).ToList();
var portalUri = new Uri("http://myportal.esri.com/portal/", UriKind.Absolute); ArcGISPortalManager.Current.AddPortal(portalUri);
//Find the portal to sign in with using its Uri... var portal = ArcGISPortalManager.Current.GetPortal(new Uri(uri, UriKind.Absolute)); if (!portal.IsSignedOn()) { //Calling "SignIn" will trigger the OAuth popup if your credentials are //not cached (eg from a previous sign in in the session) if (portal.SignIn().success) { //Set this portal as my active portal ArcGISPortalManager.Current.SetActivePortal(portal); } }
System.Object
ArcGIS.Desktop.Core.ArcGISPortalManager
Target Platforms: Windows 11, Windows 10