Since I do not have access to the SharePoint farm.

Is there any way to retrieve all available property names from UserProfiles in SharePoint 2013 through JavaScript?

What I was looking for is the names you pass as an array with the following call:

var object = new SP.UserProfiles.UserProfilePropertiesForUser(context, accountName, propertyNames);

2 Answers 2



Retrieve user profile properties by using the JavaScript object model in SharePoint 2013

var personProperties;

// Ensure that the SP.UserProfiles.js file is loaded before the custom code runs.
SP.SOD.executeOrDelayUntilScriptLoaded(getUserProperties, 'SP.UserProfiles.js');

function getUserProperties() {

    // Replace the placeholder value with the target user's credentials.
    var targetUser = "domainName\\userName";

    // Get the current client context and PeopleManager instance.
    var clientContext = new SP.ClientContext.get_current();
    var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

    // Get user properties for the target user.
    // To get the PersonProperties object for the current user, use the
    // getMyProperties method.
    personProperties = peopleManager.getPropertiesFor(targetUser);

    // Load the PersonProperties object and send the request.
    clientContext.executeQueryAsync(onRequestSuccess, onRequestFail);

// This function runs if the executeQueryAsync call succeeds.
function onRequestSuccess() {

    // Get a property directly from the PersonProperties object.
    var messageText = " \"DisplayName\" property is "
        + personProperties.get_displayName();

    // Get a property from the UserProfileProperties property.
    messageText += "<br />\"Department\" property is "
        + personProperties.get_userProfileProperties()['Department'];
    $get("results").innerHTML = messageText;

// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
    $get("results").innerHTML = "Error: " + args.get_message();



Need to make a GET request to the above end point. It will return current user's properties.

  • Thank you for the hint. I did not know of the method get_userProfileProperties()
    – apetani
    Commented Jan 13, 2016 at 9:09

To retrieve all the properties, you can use REST api such as:

var url = _spPageContextInfo.webServerRelativeUrl + "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='" + encodeURIComponent(targetUsername) + "'&$select=UserProfileProperties";

then you can look up all the available properties within 'properties' variable using FireBug/IE dev tool console.

var properties = data.d.UserProfileProperties.results; 
window.console && console.log(properties);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.