0

Is there a function call I can use to get user properties (login name, display name and\or title) from a specific user id, not the current user, but a user of my choice? I've tried a few variations out of sheer desperation with no luck.

var user = context.get_web().siteUsers().getById(userID);

or

var user = context.get_web().ensureUser(userID);

I'm not having any luck finding something. I can post the complete function I've built if need be. I'm getting .siteUser is not a function or .getById is not a function errors.

0

Using JSOM:

Try this:

 var user = context.get_web().get_siteUsers().getById('userId');//Give the user id here

Source:

How to get SharePoint User by User Id in JavaScript using JSOM

Using REST:

Try this:

http://your-site-name/_vti_bin/ListData.svc/UserInformationList(userId)

Source:

How to get user info by ID for SharePoint 2010 using REST?

| improve this answer | |
0

Here is bunch of queries for specific user across all environment :

4) 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|vardhaman@siteurl.onmicrosoft.com'

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

5) 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|vardhaman@siteurl.onmicrosoft.com'

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

6) Get Multiple UserProfile Properties for Specific User:

Update (01/06/2016): Since the time I wrote this post, REST API batching has been implemented in SharePoint Online. As a result, we can make multiple REST requests to the GetUserProfilePropertiesFor function in a single REST call. This way, we can get Multiple custom/OOB UserProfile Properties for a Specific User without making multiple calls.

Here is my post on it: SharePoint Online: Get UserProfile Properties with REST API Batching

List of User Properties (Use the GetPropertiesFor function for these):

AccountName DirectReports DisplayName Email ExtendedManagers ExtendedReports IsFollowed LatestPost Peers PersonalUrl PictureUrl" Title UserProfileProperties UserUrl

Reference URL :

SharePoint: Get User Profile Properties with REST API

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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