Forum Discussion

Linyu001's avatar
Linyu001
Copper Contributor
Jul 23, 2021

SharePoint REST: The attempted operation is prohibited because it exceeds the list view threshold

Help!!!

REST API request data in SharePoint Online list.

The list data more than 5k data, but the result of request don't more than 5k.

 

SharePoint REST API return error as below:

test-web-part_be28700c1e68b12fdf02398b82852235.js:1 Uncaught (in promise) Error: Error making HttpClient request in queryable [500] Internal Server Error ::> {"odata.error":{"code":"-2147024860, Microsoft.SharePoint.SPQueryThrottledException","message":{"lang":"en-US","value":"The attempted operation is prohibited because it exceeds the list view threshold."}}}
at new t (test-web-part_be28700c1e68b12fdf02398b82852235.js:1)
at test-web-part_be28700c1e68b12fdf02398b82852235.js:1

My Request:

https://linyus.sharepoint.com/sites/DevelopSite/_api/web/lists/getByTitle('Test')/items?$top=100&$filter=ItemType eq '1' and Test eq '1'

Error:

Result only 1 item, but REST error

  • Hi Linyu001 

     

    The first filter condition (ItemType  eq '1') is likely returning more than 5000 items. This needs to always return less than 5000 items and only after that the other filter queries are applied. 

    Also, you may already be aware, but $top will only be applied after the filter so it does not prevent the list view threshold error

    • Linyu001's avatar
      Linyu001
      Copper Contributor
      Thanks for your reply.
      I know that your reply, but I want to find if there is any other solution for the filter.
      I want to know if we can search the first filter more than 5000 but the hole filter less than 5000 items.
      Thanks again!
      • Sorry the late reply, missed the notification from your reply.
        Unfortunately this will cause an error and the first condition needs to return less than 5000 items

Resources