Newer Version Available

This content describes an older version of this product. View Latest

setPassword()

Sets the specified user’s password to the specified value. This call can’t be used to allow users to change their own passwords unless the org preference under Password Policies under Setup remains enabled. Once turned off, the org preference can’t be re-enabled.

Syntax

Usage

Use setPassword() to change the password of a User or SelfServiceUser to a value that you specify. Use resetPassword() instead if you want to reset the password with a random value generated by the API.

Your client application must be logged in with sufficient access rights to change the password for the specified user. For more information, see Factors that Affect Data Access.

For information on IDs, see ID Field Type.

This call can use the session ID returned in LoginResult if the password has expired. For more information, see passwordExpired.

Sample Code—Java

This sample accepts user ID and password parameters, which it uses in the setPassword() call to set the password of the specified user.

Sample Code—C#

This sample accepts user ID and password parameters, which it uses in the setPassword() call to set the password of the specified user.

Arguments

Name Type Description
userID ID ID of the User or SelfServiceUser whose password you want to reset. For information on IDs, see ID Field Type.
password string New password to use for the specified user.

Response

SetPasswordResult (empty)