resetPassword()

Changes a user’s password to a temporary, system-generated value.

Syntax

string password = sfdc.resetPassword(ID userID);

Usage

Use resetPassword() to request that the API change the password of a User or SelfServiceUser, and return a system-generated password string of random letters and numbers. Use setPassword() instead if you want to set the password to a specific value.

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.

Sample Code—Java

public void resetPasswordSample() {
  // Specify the user ID of the password to reset
  String idToReset = "005x0000000fFLnAAM";
  // Invoke the resetPasswordResult call
  try {
    ResetPasswordResult resetPasswordResult = binding.resetPassword(idToReset);
    // Display the new server-generated password
    System.out.println(resetPasswordResult.getPassword());
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
  }
}

Sample Code—C#

 private void resetPassword() 
 {
  //Invoke resetPassword call and save results in ResetPasswordResult
 ResetPasswordResult rpr = binding.resetPassword("userID");
  // Get the generated password
 System.Diagnostics.Trace.WriteLine(rpr.password);
 }

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.

Response

Name Type Description
password string New password generated by the API. Once the user logs in with this password, they will be asked to provide a new password. This password is temporary, meaning that it cannot be reused once the user has set his or her new password.

Fault

InvalidIdFault

UnexpectedErrorFault

See Also:
Utility Calls
https://wiki.apexdevnet.com/index.php/Sample_SOAP_Messages
© Copyright 2000-2008 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.