ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Core Namespace / ArcGISPortal Class
Members Example

In This Topic
    ArcGISPortal Class
    In This Topic
    The ArcGISPortal class is part of the Pro Portal API which provides a way to build applications that work with content from ArcGIS Online or an ArcGIS Portal. ArcGIS Portal is software technology from Esri that customers can deploy either on premise or in the cloud. ArcGIS Online is Esri's Software as a Service offering that represents GIS as a Service and is implemented using the same technology as ArcGIS Portal. The Portal API allows application developers to work with users, groups and content hosted within ArcGIS Online or within an ArcGIS Portal.
    Object Model
    ArcGISPortal ClassSignInResult ClassSignInResult Class
    Syntax
    public class ArcGISPortal 
    Public Class ArcGISPortal 
    Remarks
    ArcGISPortal instances are instantiated using the ArcGISPortalManager and its ArcGISPortalManager.AddPortalAddPortal method.
    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: Get a portal and Sign In, Set it Active
    //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);
      }
    }
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Core.ArcGISPortal

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also