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

How would I use SPServices GetListItems and still be able to add Ascending=False to the CAMLViewFields? I haven't used this for long and I am just wondering if this is possible?

Thanks as always!

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

You can specify the Ascending=False as an attribute of the FieldRef in the OrderBy element.

 $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "EmployeeList",
    CAMLViewFields: "<ViewFields></ViewFields>",
    CAMLQuery: "<Query><Where><Eq><FieldRef Name='EmployeeID'/><Value Type='Text'>1</Value></Eq></Where><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy></Query>",
    CAMLRowLimit: 1,
    completefunc: function (xData, Status) {

      });
    }
  });
}
share|improve this answer
    
perfect! thanks; greatly appreciated! –  Justin Aug 19 '12 at 0:19
add comment

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.