ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core Namespace / ArcGISPortalManager Class / GetActivePortal Method
Example

In This Topic
    GetActivePortal Method
    In This Topic
    Get the currently active portal. This is the portal that has been set as the Active Portal either via the API or on the "Portals" backstage tab.
    Syntax
    public ArcGISPortal GetActivePortal()
    Public Function GetActivePortal() As ArcGISPortal

    Return Value

    Remarks
    If an active portal has never been set then, by default, the active portal will be ArcgisOnline
    Example
    ArcGISPortalManager: Get the Current Active Portal
    var active_portal = ArcGISPortalManager.Current.GetActivePortal();
    string uri = active_portal.PortalUri.ToString();
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also