changeOwnPassword()

Lets users change their passwords from old values to new values that they specify.

Syntax

ChangeOwnPasswordResult changeOwnPasswordResult = connection.changeOwnPassword(string oldPassword, string newPassword);

Usage

Use changeOwnPassword() to allow users to change their passwords to values that they specify. For example, a client application prompts a user to specify a different password, and then invokes changeOwnPassword() to change the user’s password. Use setPassword() if you want to set a different user’s password to a value you specify. Use resetPassword() if you want to reset a target user's password with a random value generated by the API.

Sample Code—Java

This sample accepts old password and new password parameters, which it uses in the changeOwnPassword() call to set the new password of the user.

public void doChangeOwnPassword(String oldPasswd, String newPasswd) {
   try {
      ChangeOwnPasswordResult result = connection.changeOwnPassword(oldPasswd, newPasswd);
      System.out.println("Your password was changed to "
            + newPasswd);
   } catch (ConnectionException ce) {
      ce.printStackTrace();
   }
}

Sample Code—C#

This sample accepts old password and new password parameters, which it uses in the changeOwnPassword() call to set the new password of the user.

public void doChangeOwnPassword(String oldPasswd, String newPasswd)
{
   try
   {
      ChangeOwnPasswordResult result = binding.changeOwnPassword(oldPasswd, newPasswd);
      Console.WriteLine("Your password was changed to "
            + newPasswd);
   }
   catch (SoapException e)
   {
      Console.WriteLine("An unexpected error has occurred: " +
                        e.Message + "\n" + e.StackTrace);
   }
}

Arguments

Name Type Description
oldPassword string The user’s previous password that is being replaced.
newPassword string The user’s new password.

Response

ChangeOwnPasswordResult

Fault

InvalidOldPasswordFault

InvalidNewPasswordFault

UnexpectedErrorFault