Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFSecurityMappings.Add Method (String, NTAccount, AFSecurityIdentity, String)

AFSecurityMappings.Add Method (String, NTAccount, AFSecurityIdentity, String)

  • Last UpdatedNov 18, 2025
  • 3 minute read
AFSecurityMappings.Add Method (String, NTAccount, AFSecurityIdentity, String)
The Add method creates a new AFSecurityMapping from the specified NTAccount to a AFSecurityIdentity and adds it to the collection.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFSecurityMapping Add(
	string name,
	NTAccount account,
	AFSecurityIdentity securityIdentity,
	string machineName = null
)
Public Function Add ( 
	name As String,
	account As NTAccount,
	securityIdentity As AFSecurityIdentity,
	Optional machineName As String = Nothing
) As AFSecurityMapping

Dim instance As AFSecurityMappings
Dim name As String
Dim account As NTAccount
Dim securityIdentity As AFSecurityIdentity
Dim machineName As String
Dim returnValue As AFSecurityMapping

returnValue = instance.Add(name, account, 
	securityIdentity, machineName)
public:
AFSecurityMapping^ Add(
	String^ name, 
	NTAccount^ account, 
	AFSecurityIdentity^ securityIdentity, 
	String^ machineName = nullptr
)
member Add : 
        name : string * 
        account : NTAccount * 
        securityIdentity : AFSecurityIdentity * 
        ?machineName : string 
(* Defaults:
        let _machineName = defaultArg machineName null
*)
-> AFSecurityMapping 

Parameters

name
Type: SystemString
The name for the new object, which must be unique within the collection. If not specified, then the user name associated with the specified account will be used with an asterisk (*) to ensure the name is unique.. If the specified name ends with an asterisk (*), then a unique name will be generated based on the supplied name. See the ValidateName(String, String) method for a description of what is valid when setting the name of the object.
account
Type: System.Security.PrincipalNTAccount
The NTAccount to be used when creating the new mapping. If is specified, then the account for the current user is used.
securityIdentity
Type: OSIsoft.AFAFSecurityIdentity
The AFSecurityIdentity that the account should be mapped.
machineName (Optional)
Type: SystemString
The name of the remote machine to be used as the context for resolving the account. To use the local machine, specify .

Return Value

Type: AFSecurityMapping
Returns the newly created AFSecurityMapping that was added to the collection.

Exceptions

ExceptionCondition
ArgumentException This exception is thrown when attempting to add a duplicate account to an AFSecurityIdentity.
InvalidOperationException This exception is thrown when attempting to call this method on a reference collection which does not own the object.

Remarks

The new AFSecurityMapping will be created from the specified account to a AFSecurityIdentity. If the name is not specified, then the Name of the new mapping will be the user name associated with the account. The Account of the created mapping will be the SID of the specified account parameter. The SecurityIdentity of the created mapping will be set to the specified securityIdentity parameter.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in