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.

getUserInfo()

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

Syntax

1getUserInfoResult result = connection.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

This sample calls getUserInfo() and writes information about the current user to the console.

1public void doGetUserInfo() {
2   try {
3      GetUserInfoResult result = connection.getUserInfo();
4      System.out.println("\nUser Information");
5      System.out.println("\tFull name: " + result.getUserFullName());
6      System.out.println("\tEmail: " + result.getUserEmail());
7      System.out.println("\tLocale: " + result.getUserLocale());
8      System.out.println("\tTimezone: " + result.getUserTimeZone());
9      System.out.println("\tCurrency symbol: " + result.getCurrencySymbol());
10      System.out.println("\tOrganization is multi-currency: " + 
11            result.isOrganizationMultiCurrency());
12   } catch (ConnectionException ce) {
13      ce.printStackTrace();
14   }
15}

Sample Code—C#

This sample calls getUserInfo() and writes information about the current user to the console.

1public void doGetUserInfo()
2{
3   try
4   {
5      GetUserInfoResult result = binding.getUserInfo();
6      Console.WriteLine("\nUser Information");
7      Console.WriteLine("\tFull name: " + result.userFullName);
8      Console.WriteLine("\tEmail: " + result.userEmail);
9      Console.WriteLine("\tLocale: " + result.userLocale);
10      Console.WriteLine("\tTimezone: " + result.userTimeZone);
11      Console.WriteLine("\tCurrency symbol: " + result.currencySymbol);
12      Console.WriteLine("\tOrganization is multi-currency: " +
13            result.organizationMultiCurrency);
14   }
15   catch (SoapException e)
16   {
17      Console.WriteLine("An unexpected error has occurred: " +
18                        e.Message + "\n" + e.StackTrace);
19   }
20}

Arguments

None.