How to get the nth record (lets say 133rd) from the 1000 records (or unknown number of records) by using CAML query.

5 Answers 5


You would need to figure out what qualifies the "133rd" record? Is is the ID (most cases, but not reliable as it does functions like in SQL database for auto-incremented column), is it the last modified date, created date, etc. What I've used to do was to use an OrderBy numeric column (0 decimals - so it integer) that I've always sorted after.

Once this is established you could even combine multiple clauses to get closer to your record, via OrderBy and Where, see here explanations http://weblogs.asp.net/uruit/archive/2010/06/15/how-to-add-new-filters-to-caml-queries-in-sharepoint-2007.aspx

Once you get your results back, just use LINQ to get your Last(), see here something similar Getting items from rows 4-8 in a Sharepoint list using CAML query?

Recomandations for large lists are to use in your Query any of the ContentIterator.ItemEnumerationOrderByID, ContentIterator.ItemEnumerationOrderByPath, or ContentIterator.ItemEnumerationOrderByNVPField in the OrderBy clause, see here for more http://msdn.microsoft.com/en-us/library/ee558807(v=office.14)


as said in above reply you can get specific no. of records using RowLimit. TO get nth record only you can use "ID" field to get specific reocrd.

i.e Where ID = "your number"

before firing query to retrive the nth make sure list contains n no. of records

Regards, Ketan

  • @Ketan03... wow thats great. Here ID means row number? can you please provide me better link to learn CAML
    – Mihir
    Aug 9, 2012 at 6:32
  • @Mihir you can download the U2U CAML builder tool from google and you can easily generate the query and use the same in your code. If above answered has helped please do mrk it as "Useful".
    – Ketan03
    Aug 9, 2012 at 7:04
  • Just to point out this will only provide you with the correct result if no list item has ever been deleted from the list. Jun 13, 2013 at 19:42

You could use RowLimit

     <FieldRef Name='aField' Ascending='False' />
  • this will give upto 133 records right!! I want to display only one 133rd record.
    – Mihir
    Aug 9, 2012 at 6:31
  • Thats true, I thought you didn't have a unique identifier to go after. If you have ofc use Where Identifier eq 133 Aug 9, 2012 at 6:46

Do you have any kind of identifier of that record? If so, just use Where clausule to select 1 record.

If not, you should just specify some argument in Where clausule to filter records (if possible), use Order By (if needed) and of course use RowLimit set to value of "n" and then use linq to get .Last() item in result set.

Yes, you will get "n" results but if you have no specific identifier for your record there is no other option.

If you need more help, try to be more specific about your scenario - eg. why you need nth record.


The easiest answer would be:


But I doubt you accept it ;)

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.