SharePoint 2013: Get UserProfile Properties with REST API
In my last post about SharePoint 2013 user profile properties, we saw how to get them using the JavaScript Client Object Model. In this post lets have a look at how to get them using the REST API. Here is a quick reference for the REST API endpoints.
(List of All User Properties and UserProfile Properties at the end of the post)
1) Get all properties of current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties2) Get single property of current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties/PictureUrlOR
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl
3) Get Multiple Properties for the current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl,AccountName4) 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-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\username'
5) Get Specific UserProfile Property of Specific User:
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-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'
6) Get Multiple UserProfile Properties for Specific User:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertiesFor
_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertiesFor
As far as my research is concerned, this method is NOT supported in the REST API. The call to this method returns the following error:
"The method GetUserProfilePropertiesFor cannot be invoked as its parameter propertiesForUser is not supported."
If anybody finds any additional information on this, then I would love to update my blog on it. Here is my code for executing the above method:
1234567891011121314151617181920212223242526 |
|
No comments:
Post a Comment