changeOwnPassword()

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

Syntax 

1ChangeOwnPasswordResult 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.

1public void doChangeOwnPassword(String oldPasswd, String newPasswd) {
2   try {
3      ChangeOwnPasswordResult result = connection.changeOwnPassword(oldPasswd, newPasswd);
4      System.out.println("Your password was changed to "
5            + newPasswd);
6   } catch (ConnectionException ce) {
7      ce.printStackTrace();
8   }
9}

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.

1public void doChangeOwnPassword(String oldPasswd, String newPasswd)
2{
3   try
4   {
5      ChangeOwnPasswordResult result = binding.changeOwnPassword(oldPasswd, newPasswd);
6      Console.WriteLine("Your password was changed to "
7            + newPasswd);
8   }
9   catch (SoapException e)
10   {
11      Console.WriteLine("An unexpected error has occurred: " +
12                        e.Message + "\n" + e.StackTrace);
13   }
14}

Arguments 

NameTypeDescription
oldPasswordstringThe user’s previous password that is being replaced.
newPasswordstringThe user’s new password.

Response 

ChangeOwnPasswordResult

Fault 

InvalidOldPasswordFault

InvalidNewPasswordFault

UnexpectedErrorFault

See Also