ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Core Namespace / ArcGISPortalManager Class / GetPortal Method
The URI that will be used to search for a matching portal
Example

In This Topic
    GetPortal Method
    In This Topic
    Get the Portal from the list of portals based on the provided portalURI
    Syntax
    public ArcGISPortal GetPortal( 
       Uri portalUri
    )
    Public Function GetPortal( _
       ByVal portalUri As Uri _
    ) As ArcGISPortal

    Parameters

    portalUri
    The URI that will be used to search for a matching portal

    Return Value

    Example
    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);
      }
    }
    
    Portal: Get the organization id for the current user
    var portal = ArcGISPortalManager.Current.GetPortal(new Uri(portalUri));
    var portalInfo = await portal.GetPortalInfoAsync();
    var orgid = portalInfo.OrganizationId;
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also