Forum Discussion
The attempted operation is prohibited because it exceeds the list view threshold
I am using caml query as below:
"<View><Query><Where><And><Eq><FieldRef Name = 'NumericRecordId'/><Value Type = 'Integer'>xxxxxxx</Value></Eq><Eq><FieldRef Name = 'ContextId'/><Value Type = 'Integer'>xxxxxx</Value></Eq></And></Where><View><OrderBy><FieldRef Name='NumericRecordId' Ascending='False' /></View></Query><ViewFields><FieldRef Name='Title' /></ViewFields><RowLimit>100</RowLimit></View>"
This works fine for records less than 5000 in my document library. But once it exceeds 5000 i get threshold error.
ContextId and NumericRecordId are Indexed columns. I tried many different online solutions but not able to get through this. Any help will be much appreciated. Thanks
8 Replies
- Well, what I would recommend here is to use search API instead of doing a CAML Query
- Ankush_DagaCopper Contributor
jcgonzalezmartin I tried with the search api's as well and again ran into same issue after 5000 records as api returns 500 (Internal Server Error) while applying filters.
- Sudharsan KIron Contributor
Ankush_Daga Have you tried using PnPJS with paged items method. Please refer the below link
https://pnp.github.io/pnpjs/sp/items/#get-paged-items
Please refer the below link using Search API using PnPJS
https://pnp.github.io/pnpjs/sp/search/#paging-with-searchresultsgetpage
Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue
-Sudharsan K...
- Ankush_DagaCopper Contributor
jcgonzalezmartin Thanks for your suggestion . can you just provide an example on how to call them with multiple parameters and integrate them?