sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Rest API not returning all users when searching

Open Kris3D opened this issue 1 year ago • 2 comments

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

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

Kris3D avatar Mar 17 '24 21:03 Kris3D

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 avatar Mar 18 '24 11:03 aaclage

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

Kris3D avatar Mar 18 '24 15:03 Kris3D

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.

  1. Ensure you have the desired data indexed
  2. Check the configuration of the managed property: is it included in the full text index?
  3. What about if you explicitly specify the managed property as a property restriction query (mean yourproperty:user instead of user)

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

stevebeauge avatar Apr 05 '24 10:04 stevebeauge

Hello @Kris3D, Thank you for bringing this issue to our attention. Could you please confirm if the issue still persists for you?

Amey-MSFT avatar Jun 23 '25 04:06 Amey-MSFT

We are closing this issue for now. If the problem persists, feel free to reopen it or open a new one.

Amey-MSFT avatar Jul 07 '25 10:07 Amey-MSFT