SharePoint people search API, get a list of all departments

Regular Contributor

Is there a way in SharePoint people search rest API to get a list of all deparments? A query like querytext='Department:{searchterms}'&selectproperties='Department'&trimDuplicates=true returns a duplicate list of departments.

1 Reply
best response confirmed by Gurdev Singh (Regular Contributor)

@Gurdev Singh 


There is not API by which you can get only Department in People Search because it actually gives result as People (User Profiles).


But Department in user profile is being managed by "Department" Termset in Managed Metadata by SharePoint as shown in below screen shot so you can access all the terms of Department termset.




Rest API reference articles to read all the terms of Termsets: 


Hope it will helpful to you and if so then please like it and mark this as best response for better reach of the questions to other people.