1

Is it possible to get the department of the current user using REST API (Javascript)?

6

Yes, it is possible.. Try the following request:

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

If this doesn't work you might need to use the following:

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'

Reference:

SharePoint 2013: Get UserProfile Properties with REST API

  • Thank you @Arsalan... I was killing myself on this, the thing is that it seems that the property is not configured in my server – yngrdyn May 8 '15 at 14:09
  • how about current user? without passing @v parameter – Vignesh Subramanian Nov 10 '16 at 9:49
  • http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties This call will give you all properties for current user. – Arsalan Adam Khatri Nov 15 '16 at 5:25

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.