Wondering if anyone has a suggestion for querying a large list > 5000 items to get all the checked out files (recursively).

Can I query the search index for this?

Here's what I've done so far without success on a large list (works for smaller):

REST: /_api/web/lists/getbytitle('Documents')/items?$select=CheckoutUserId/Title&$filter=CheckoutUserId ne null";


camlQuery.ViewXml = @"<View Scope='RecursiveAll'><Query><Where><IsNotNull><FieldRef Name='CheckoutUser' /></IsNotNull></Where><OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy></Query><RowLimit>100</RowLimit></View>";
  • Could you check if it is possible to index the CheckOutUser field in the list settings? In general indexing a field will help you with this issue. – Frank H Jul 14 '17 at 15:38
  • Its a good suggestion, unfortunately because the list is beyond the limit it throws this error "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator. " – Chris Jul 14 '17 at 19:44

You can do small change to your REST query


/_api/web/Lists/getByTitle('Documents')/Items?$filter=CheckoutUserId ne null&$top=100

In the response, if you have more records to match your request it will give link to get the next set of items.

<link rel="next" href="siteurl/_api/web/Lists/getByTitle('Documents')/Items?%24skiptoken=Paged%3dTRUE%26p_SortBehavior%3d1%26p_ID%3d850&amp;%24top=10"/>

This can see from the browser response and from JavaScript you get from data.d object.

You can repeat the calls until this value null/undefined/empty.

| improve this answer | |
  • Appreciate the info but I think its still stuck on the threshold.. For some reason even simple queries are returning "The remote server returned an error: (400) Bad Request." – Chris Jul 14 '17 at 20:03
  • This has been tested. Can You give me your query? – Venkat Konjeti Jul 14 '17 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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