ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Core Namespace / ArcGISPortalManager Class / Current Property
Example

In This Topic
    Current Property (ArcGISPortalManager)
    In This Topic
    Gets the singleton ArcGISPortalManager instance
    Syntax
    Public Shared ReadOnly Property Current As ArcGISPortalManager
    public static ArcGISPortalManager Current {get;}
    Example
    ArcGISPortalManager: Get the Current Active Portal
    {
      var active_portal = ArcGISPortalManager.Current.GetActivePortal();
      string uri = active_portal.PortalUri.ToString();
    }
    ArcGISPortalManager: Get a list of all your Portals
    {
      var portals = ArcGISPortalManager.Current.GetPortals();
      //Make a list of all the Uris
      var portalUris = portals.Select(p => p.PortalUri.ToString()).ToList();
    }
    ArcGISPortalManager: Add a portal to the list of portals
    {
      var portalUri = new Uri("http://myportal.esri.com/portal/", UriKind.Absolute);
      ArcGISPortalManager.Current.AddPortal(portalUri);
    }
    ArcGISPortalManager: Get a portal and Sign In, Set it Active
    {
      //Find the portal to sign in with using its Uri...
      var uri = new Uri("http://myportal.esri.com/portal/", UriKind.Absolute);
      var aPortal = ArcGISPortalManager.Current.GetPortal(uri);
      if (!aPortal.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);
        }
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also