Select to view content in your preferred language

How can I get current user or license info?

500
3
10-18-2023 03:10 AM
ViktorSafar
Occasional Contributor II

I need to print the current user or some other identifying information onto a layout. I have the layout part but I cannot find out how do I get some sort of user or license object.

EIDT: I had forgotten to mention there is no Portal connection as the machine is offline.

0 Kudos
3 Replies
StephenRhea_NV5
Occasional Contributor
// To get the system user name
var systemUser = System.Environment.UserName;

// To get the Portal user name (in 2.9; I haven't looked at 3.x)
var portalUser = ArcGISPortalManager.Current.GetActivePortal().GetSignOnUsername();
0 Kudos
ViktorSafar
Occasional Contributor II

Thanks. I had forgotten to mention there is no Portal connection as the machine is offline.

0 Kudos
VedantBajaj
Esri Contributor
public static LicenseLevels Level {get;}

You should be able to use this to get the LicenseLevel.

Documentation: https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic8899.html 

0 Kudos