3

Is it possible to get listitems between a specified Row Index Boundary from a list using CAML

Ex: if there are 10000 records I would like to fetch records between 201 - 250

2 Answers 2

2

You can use below code in your solutions-

SPQuery w = new SPQuery() ; w.RowLimit = 10; w.Query = "1570";

2
  • SPQuery w = new SPQuery() ; w.RowLimit = 50; w.Query = "<Where><Gt><FieldRef Name='ID'/><Value Type='Counter'>1570</Value></Gt></Where>"; Commented Aug 23, 2010 at 10:04
  • 1
    The problem is that ID's don;t have to be consecutive, if say item 100 to 300 are deleted, those id's are gone. Once an item has been created, ID's don't change. so querying for 201 - 250 will return an empty result
    – Colin
    Commented Jun 11, 2011 at 22:23
2

This link has some info about generating pages of results in a CAML query, I have heard that this is ill-advised, though the function detailed in the article seems like a good solution:

Link

Your Answer

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

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