SOLVED

SharePoint people search API, get a list of all departments

Iron 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 (Iron Contributor)
Solution

@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.

 

kalpeshvaghela_0-1660290216768.png

 

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.

 

 

 

1 best response

Accepted Solutions
best response confirmed by Gurdev Singh (Iron Contributor)
Solution

@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.

 

kalpeshvaghela_0-1660290216768.png

 

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.

 

 

 

View solution in original post