getUserInfo()

Retrieves personal information for the user associated with the current session.

Syntax

GetUserInfoResult result = sfdc.getUserInfo();

Usage

Use getUserInfo() to obtain personal information about the currently logged-in user. This convenience API call retrieves and aggregates common profile information that your client application can use for display purposes, performing currency calculations, and so on.

The getUserInfo() call applies only to the username under which your client application has logged in. To retrieve additional personal information not found in the GetUserInfoResult object, you can call retrieve() on the User object and pass in the userID returned by this call. To retrieve personal information about other users, you could call retrieve() (if you know their user ID) or query() on the User object.

Sample Code—Java

public void getUserInfoSample() {
  GetUserInfoResult getUserInfoResult = null;
  try {
    // Invoke the getUserInfo call
    getUserInfoResult = binding.getUserInfo();
   // Display the returned user information
    System.out.println("User's currency symbol: " + getUserInfoResult.getCurrencySymbol());
    System.out.println("User's organization name: " + 
               getUserInfoResult.getOrganizationName());
    System.out.println("User's default currency code: " + 
               getUserInfoResult.getUserDefaultCurrencyIsoCode());
    System.out.println("User's email: " + getUserInfoResult.getUserEmail());
    System.out.println("User's full name: " + getUserInfoResult.getUserFullName());
    System.out.println("User's user id: " + getUserInfoResult.getUserId());
    System.out.println("User's language: " + getUserInfoResult.getUserLanguage());
    System.out.println("User's locale: " + getUserInfoResult.getUserLocale());
    System.out.println("User's timezone: " + getUserInfoResult.getUserTimeZone());
    System.out.println("User's org is multi currency: " + 
               getUserInfoResult.isOrganizationMultiCurrency());
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
  }
}         

Sample Code—C#

private void getUserInfo()
{
//Invoke getUserInfo call and save the results in getUserInfoResult
GetUserInfoResult ui = binding.getUserInfo();
// Get some of the user information
String orgName = ui.organizationName;
String userFullName = ui.userFullName;
}

Arguments

None.

Response

GetUserInfoResult

Fault

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.