Forum Discussion

Gurdev Singh's avatar
Gurdev Singh
Iron Contributor
Aug 12, 2022

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.

  • 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:

    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.

     

     

     

  • 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:

    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.

     

     

     

Resources