Sharepoint Lists.GetListItems sorting

I am making a web method call List.GetListItems for sharepoint via my C # code. Can a list be sorted from sharepoint? Or do I need to sort it after extraction in my C # code? I was unable to find any option in the query or queryOptions.

Thanks.

0


a source to share


2 answers


See http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx

GetListItems contains a 'query' parameter. If you pass the xml node in this request with something like:



<OrderBy><FieldRef Name='fieldnametosort' /></OrderBy>

      

You will get a sorted list.

+1


a source


It worked for us.

<Query><OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy></Query>

      



Note the extra <Query>

around <OrderBy>

. We tried ows_Modified

as a name that didn't work.

0


a source







All Articles