Monday, June 5, 2017

Get Department for current user using REST API

To get the department property of the logged in user -

http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=Department

To get all the properties of another user -

For Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Department')?@v='i:0%23.f|membership|user@siteurl.onmicrosoft.com'
For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='Department')?@v='domain\username'


No comments:

Post a Comment

Clearing Person/Group Values

To clear out or empty the values in person or group columns, how you do it depends on if the column is single-value or multi-value. For ...