Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
changeOwnPassword()
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
| Name | Type | Description |
|---|---|---|
| oldPassword | string | The user’s previous password that is being replaced. |
| newPassword | string | The user’s new password. |
Response
ChangeOwnPasswordResult