1

How do I create a CAML query to display all items on the list order by ItemChildCount?

Somewhat like this:

 Select * 
 from table 
 order by itemChildCount descending 
2

I believe the OrderBy Element is what you're looking for:

SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef Name='ItemChildCount' Ascending='FALSE' /></OrderBy>"; 

Adapted from the example here: SPQuery.ViewFields

Additionally, this is a useful CAML Query reference: Query Schema

2

Tools like Strammit or U2U can help you build any CAML you desire.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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