AFSecurity.GetUserId Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Get the user identifier for the specified user name.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static int GetUserId( PISystem system, string userName )
Public Shared Function GetUserId ( system As PISystem, userName As String ) As Integer Dim system As PISystem Dim userName As String Dim returnValue As Integer returnValue = AFSecurity.GetUserId(system, userName)
public: static int GetUserId( PISystem^ system, String^ userName )
static member GetUserId : system : PISystem * userName : string -> int
Parameters
- system
- Type: OSIsoft.AFPISystem
The user identifier The PISystem being used to evaluate the user name. - userName
- Type: SystemString
The name of the requested user identifier to be returned.
Return Value
Type: Int32Returns the user identifier for the requested user name within the specified system.
Remarks
Each PISystem maintains a list of known users with a unique
identifier used within that server. This method will return the user identifier
for a user name within the specified PISystem.
This can be used to specify the SecurityOwnerId
when creating an AFSecurityRightsToken.