AuthenticablePrincipal.ChangePassword Method (String, String)

 

Changes the account password from the old password to the new password. Do not use this with a ComputerPrincipal.

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

public void ChangePassword(
	string oldPassword,
	string newPassword
)

Parameters

oldPassword
Type: System.String

The password that is changed.

newPassword
Type: System.String

The new password.

Exception Condition
InvalidOperationException

The principal has not been persisted.

PasswordException

The new password does not meet the complexity requirements.

NotSupportedException

The principal is not a user.

This method is not intended for computer principals. Calling this with a ComputerPrincipal will cause a NotSupportedException to be thrown.

.NET Framework
Available since 3.5
Return to top
Show: