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
var query = new SPQuery
  Query = "<OrderBy><FieldRef Name="Created" Ascending="False" /></OrderBy>",
  RowLimit = 100

Does this return the 100 most recently created items? I'm not confident that an order without a query will return the 100 most recent items.

I'm concerned this will return 100 random items, and THEN order by creation date. Does anyone know if this is true or false?

share|improve this question
up vote 3 down vote accepted

The OrderBy element specifies how to sort the items which will be returned. So this query will indeed return the 100 most recently created items and not random items.

You can use U2U CAML Builder to test such queries.

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.