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

%3CLINGO-SUB%20id%3D%22lingo-sub-2578706%22%20slang%3D%22en-US%22%3ESharePoint%20REST%3A%20The%20attempted%20operation%20is%20prohibited%20because%20it%20exceeds%20the%20list%20view%20threshold%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2578706%22%20slang%3D%22en-US%22%3E%3CP%3EHelp!!!%3C%2FP%3E%3CP%3EREST%20API%20request%20data%20in%20SharePoint%20Online%20list.%3C%2FP%3E%3CP%3EThe%20list%20data%20more%20than%205k%20data%2C%20but%20the%20result%20of%20request%20don't%20more%20than%205k.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESharePoint%20REST%20API%20return%20error%20as%20below%3A%3C%2FP%3E%3CP%3Etest-web-part_be28700c1e68b12fdf02398b82852235.js%3A1%20Uncaught%20(in%20promise)%20Error%3A%20Error%20making%20HttpClient%20request%20in%20queryable%20%5B500%5D%20Internal%20Server%20Error%20%3A%3A%26gt%3B%20%7B%22odata.error%22%3A%7B%22code%22%3A%22-2147024860%2C%20Microsoft.SharePoint.SPQueryThrottledException%22%2C%22message%22%3A%7B%22lang%22%3A%22en-US%22%2C%22value%22%3A%22The%20attempted%20operation%20is%20prohibited%20because%20it%20exceeds%20the%20list%20view%20threshold.%22%7D%7D%7D%3CBR%20%2F%3Eat%20new%20t%20(test-web-part_be28700c1e68b12fdf02398b82852235.js%3A1)%3CBR%20%2F%3Eat%20test-web-part_be28700c1e68b12fdf02398b82852235.js%3A1%3C%2FP%3E%3CP%3EMy%20Request%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Flinyus.sharepoint.com%2Fsites%2FDevelopSite%2F_api%2Fweb%2Flists%2FgetByTitle('Test')%2Fitems%3F%24top%3D100%26amp%3B%24filter%3DItemType%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flinyus.sharepoint.com%2Fsites%2FDevelopSite%2F_api%2Fweb%2Flists%2FgetByTitle('Test')%2Fitems%3F%24top%3D100%26amp%3B%24filter%3DItemType%3C%2FA%3E%20eq%20'1'%20and%20Test%20eq%20'1'%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EError%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222021-07-22_172441.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F297940iAB3ADF2C4945D1CF%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222021-07-22_172441.png%22%20alt%3D%222021-07-22_172441.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EResult%20only%201%20item%2C%20but%20REST%20error%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222021-07-22_172422.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F297939i568CD359EDC17B31%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222021-07-22_172422.png%22%20alt%3D%222021-07-22_172422.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2581683%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20REST%3A%20The%20attempted%20operation%20is%20prohibited%20because%20it%20exceeds%20the%20list%20view%20threshol%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2581683%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1110808%22%20target%3D%22_blank%22%3E%40Linyu001%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3EThe%20first%20filter%20condition%20(ItemType%26nbsp%3B%3CSPAN%3E%26nbsp%3Beq%20'1')%20is%20likely%20returning%20more%20than%205000%20items.%20This%20needs%20to%20always%20return%20less%20than%205000%20items%20and%20only%20after%20that%20the%20other%20filter%20queries%20are%20applied.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20data-unlink%3D%22true%22%3E%3CSPAN%3EAlso%2C%20you%20may%20already%20be%20aware%2C%20but%20%24top%20will%20only%20be%20applied%20after%20the%20filter%20so%20it%20does%20not%20prevent%20the%20list%20view%20threshold%20error%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2582035%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20REST%3A%20The%20attempted%20operation%20is%20prohibited%20because%20it%20exceeds%20the%20list%20view%20threshol%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2582035%22%20slang%3D%22en-US%22%3EThanks%20for%20your%20reply.%3CBR%20%2F%3EI%20know%20that%20your%20reply%2C%20but%20I%20want%20to%20find%20if%20there%20is%20any%20other%20solution%20for%20the%20filter.%3CBR%20%2F%3EI%20want%20to%20know%20if%20we%20can%20search%20the%20first%20filter%20more%20than%205000%20but%20the%20hole%20filter%20less%20than%205000%20items.%3CBR%20%2F%3EThanks%20again!%3C%2FLINGO-BODY%3E
New Contributor

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&$fi... eq '1' and Test eq '1'

Error:

2021-07-22_172441.png

Result only 1 item, but REST error

2021-07-22_172422.png

3 Replies

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

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