ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Core Namespace / ArcGISPortal Class / IsSignedOn Method
Example

In This Topic
    IsSignedOn Method (ArcGISPortal)
    In This Topic
    Gets the sign on status of the portal instance. This method should be called from within a QueuedTask or System.Threading.Task unless the caller is within ArcGIS.Desktop.Framework.Contracts.ConfigurationManager.OnApplicationInitializing in which case the main thread should be used.
    Syntax
    public bool IsSignedOn()
    Public Function IsSignedOn() As Boolean

    Return Value

    Exceptions
    ExceptionDescription
    Thrown when a method is called on the wrong Pro thread
    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 Current signed in User from the active portal
    var portal = ArcGISPortalManager.Current.GetActivePortal();
    //Force login
    if (!portal.IsSignedOn())
    {
      portal.SignIn();
    }
    var user = portal.GetSignOnUsername();
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also