Rest API not returning all users when searching
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Developer environment
None
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [X] 💥 Microsoft Edge
- [ ] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
- browser version
- SPFx version
- Node.js version
- etc
Describe the bug / error
API search on localpeople does not return all users. Only a portion of the users present are returned when queried.
Steps to reproduce
- call the rest api and search for users. Not all are returned as should be expected. https://tenantname.sharepoint.com/_api/search/query?querytext='user'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'
Expected behavior
Return all users when calling the search API for users.
Dear Mr. @Kris3D
After review you post this looks to be related with query build, maybe could recommend review associated doc below: https://learn.microsoft.com/en-us/sharepoint/dev/general-development/sharepoint-search-rest-api-overview
There are multiple parameters that could help display content sample "rowlimit=30", take in consideration that search uses paging approach to display content, don't know if this could be the reason is not displaying all users
@aaclage
The query is not the problem. When I search for a specific user using the office Portal and through the API, I get different results. The API doesn't return all matching users. Rowlimit has nothing to do with it since the max results of my query don't exceed 5 users when testing. The SP https://mytenant-admin.sharepoint.com/_layouts/15/TenantProfileAdmin/ManageUserProfileServiceApplication.aspx gives correct results.
Can you try using Search Query tool, and search your user with its exact user name ? Then, in the result pane you can see "all managed metadata" associated with the search item.
- Ensure you have the desired data indexed
- Check the configuration of the managed property: is it included in the full text index?
- What about if you explicitly specify the managed property as a property restriction query (mean
yourproperty:userinstead ofuser)
As a side note, be aware the user profile indexation has a very low reindexing rate; if you setup custom schema mapping, you may have to wait up to 1 week to see the result
Hello @Kris3D, Thank you for bringing this issue to our attention. Could you please confirm if the issue still persists for you?
We are closing this issue for now. If the problem persists, feel free to reopen it or open a new one.