I need to show the User profile Picture, Department, and location for every individual user who is Creating or adding the document to the library. I think we need to get the properties based on Authors name? I tried, but I got only current user Properties. please suggest me some idea to achieve this.

2 Answers 2


Try as below using REST API:

var accountName = 'domain\user';
        url: "https://sitecollectionurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='" + encodeURIComponent(accountName) + "'",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
        error: function (data) {

If you are using JSOM, try below code:

var personProperties;

SP.SOD.executeFunc('SP.js', 'SP.ClientContext', function() {
   // Make sure PeopleManager is available 
   SP.SOD.executeFunc('userprofile', 'SP.UserProfiles.PeopleManager', function() {   


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() {

// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
  • Thanks, I hope above script is for getting the Current user Profile properties right? But I need to get User profile properties based on Created by column
    – Debugger
    Commented Jan 3, 2017 at 9:31
  • var targetUser = "domainName\\userName"; or accountName='domain\user', here you can pass the author name. So, whatever is the user you pass in these variables, the properties of that account will be fetched. Commented Jan 3, 2017 at 9:33

You can use following rest api URL to get required properties

Get all properties of Specific User:

For Office 365/SharePoint Online: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|[email protected]'

For SharePoint 2013 On-Premise: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\username'

Get Specific UserProfile Property of Specific User:

For Office 365/SharePoint Online: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='i:0%23.f|membership|[email protected]'

For SharePoint 2013 On-Premise: http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'

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.