SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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

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

share|improve this answer

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

share|improve this answer
@Ketan03... wow thats great. Here ID means row number? can you please provide me better link to learn CAML – Mihir Aug 9 '12 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 '12 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. – Robert Kaucher Jun 13 '13 at 19:42

You could use RowLimit

     <FieldRef Name='aField' Ascending='False' />
share|improve this answer
this will give upto 133 records right!! I want to display only one 133rd record. – Mihir Aug 9 '12 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 – Anders Aune Aug 9 '12 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.

share|improve this answer

The easiest answer would be:


But I doubt you accept it ;)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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