Forum Discussion
SharePoint people search API, get a list of all departments
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.
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:
https://www.c-sharpcorner.com/blogs/sharepoint-managed-metadata-services-rest-api
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.
- kalpeshvaghelaSteel Contributor
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:
https://www.c-sharpcorner.com/blogs/sharepoint-managed-metadata-services-rest-api
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.