Public Function SetActivePortal( _ ByVal portalObj As ArcGISPortal _ ) As Boolean
public bool SetActivePortal( ArcGISPortal portalObj )
Parameters
- portalObj
- The portal to be set active
Public Function SetActivePortal( _ ByVal portalObj As ArcGISPortal _ ) As Boolean
public bool SetActivePortal( ArcGISPortal portalObj )
| Exception | Description |
|---|---|
| PortalConnectionDoesNotExistsException | This method or property must be called on a valid ArcGISPortal object. This object may have been edited or removed. |
| ArcGIS.Core.CalledOnWrongThreadException | Thrown when a method is called on the wrong Pro thread |
{
//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);
}
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)