ChangePassword Method

AuthenticablePrincipal.ChangePassword Method (String, String)

.NET Framework (current version)
 

Changes the account password from the old password to the new password. Do not use this with a T:System.DirecoryServices.AccountManagement.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.

T:System.DiectoryServices.AccountManagement.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 T:System.DirecoryServices.AccountManagement.ComputerPrincipal will cause a NotSupportedException to be thrown.

.NET Framework
Available since 3.5
Return to top
Show:
© 2016 Microsoft