Is there a sure fire way to discern whether the users logged in portal is enterprise or AGOL?
I thought about a string test against portalInfo.OrganizationId == "0123456789ABCDEF"
which I believe is always Enterprise - but could this value ever change and as a result break my test?
Or there is portalInfo.PortalName which returns "ArcGIS Enterprise" - but could this be changed too?
Anyway if there is someone who knows more than me, I'm all ears ![]()
Simon.
Solved! Go to Solution.
You can use either the hostname, name, or the IsPortal flag (true if not AGOL) from PortalInfo:

using this snippet:
protected override async void OnClick()
{
try
{
var portal = ArcGISPortalManager.Current.GetActivePortal();
//Force login
if (!portal.IsSignedOn())
{
portal.SignIn();
}
//If the sign in failed, this will be the default view of the portal
var portalInfo = await portal.GetPortalInfoAsync();
MessageBox.Show($@"hostname: {portalInfo.PortalHostName} name: {portalInfo.PortalName} isportal: {portalInfo.IsPortal}");
}
catch (Exception ex)
{
MessageBox.Show($@"Error: {ex}");
}
}
Hi, Can someone from ESRI just give me an idea where to go with this - it would be much appreciated.
You can use either the hostname, name, or the IsPortal flag (true if not AGOL) from PortalInfo:

using this snippet:
protected override async void OnClick()
{
try
{
var portal = ArcGISPortalManager.Current.GetActivePortal();
//Force login
if (!portal.IsSignedOn())
{
portal.SignIn();
}
//If the sign in failed, this will be the default view of the portal
var portalInfo = await portal.GetPortalInfoAsync();
MessageBox.Show($@"hostname: {portalInfo.PortalHostName} name: {portalInfo.PortalName} isportal: {portalInfo.IsPortal}");
}
catch (Exception ex)
{
MessageBox.Show($@"Error: {ex}");
}
}
Thanks Wolf!