Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.
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

1 Answer 1

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

 
discard

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.