1

I am querying list using REST.

API: siteURL = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Test')/items?$top=5000&$filter=((BBEmail eq '"+_spPageContextInfo.userLoginName+"')or(OpexCatalystEmail eq '"+_spPageContextInfo.userLoginName+"')or(PEGLeadEmail eq '"+_spPageContextInfo.userLoginName+"'))&$orderby=Modified desc";

The fields below are indexed.

  • BBEmail
  • PEGLeadEmail
  • OpexCatalystEmail
  • Modified

Still getting the threshold error when hitting the api.

{"readyState":4,"responseText":"{\"error\":{\"code\":\"-2147024860, Microsoft.SharePoint.SPQueryThrottledException\",\"message\":{\"lang\":\"en-US\",\"value\":\"The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.\"}}}","responseJSON":{"error":{"code":"-2147024860, Microsoft.SharePoint.SPQueryThrottledException","message":{"lang":"en-US","value":"The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator."}}},"status":500,"statusText":"error"}

1 Answer 1

0

the $top=5000 only seems to work when there is no filter or orderby. You'll have to filter on the front end after the results are returned. I haven't found any solution around this. If I do I'll come back and update my answer. I have seen some suggest that the columns that you filter on and orderby need to be indexed. Mine are indexed and I still get the threshold error.

update: even though this is speaking to 2010 this answer seems to point what has been tested as true. The filter results have to be under 5k otherwise you'll hit the threshold limit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.