UserPrincipal Constructor (PrincipalContext, String, String, Boolean)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the UserPrincipal class by using the specified context, SAM account name, password, and enabled value.

Namespace:   System.DirectoryServices.AccountManagement
Assembly:  System.DirectoryServices.AccountManagement (in System.DirectoryServices.AccountManagement.dll)

public UserPrincipal(
	PrincipalContext context,
	string samAccountName,
	string password,
	bool enabled
)

Parameters

context
Type: System.DirectoryServices.AccountManagement.PrincipalContext

The PrincipalContext that specifies the server or domain against which operations are performed.

samAccountName
Type: System.String

The SAM account name for this user principal.

password
Type: System.String

The password for this account.

enabled
Type: System.Boolean

A Boolean value that specifies whether the account is enabled.

The user principal account is not persisted when it is created. To save the account, call the Save method.

.NET Framework
Available since 3.5
Return to top
Show: