Partager via


How to use OrderBy using GetListItems method of SiteData.asmx (SPS 2003)

Sample code

--------------

SiteData.SiteData srvSiteData = new SiteData.SiteData();
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;
string items = srvSiteData.GetListItems("{48414507-4436-4D47-BE59-9834D33F2B52}","<Query><OrderBy><FieldRef Name=\"Modified\" Ascending=\"True\"></FieldRef></OrderBy></Query>",
"<FieldRef Name=\"Title\"/><FieldRef Name=\"Modified\"/>", 100);

 

If the Query looks like

<Query><OrderBy><FieldRef Name=\"Modified\" Ascending=\"True\"></FieldRef></OrderBy></Query> the orderby would not work.

 

Change the XML Query to
<OrderBy><FieldRef Name=\"Modified\" Ascending=\"True\"></FieldRef></OrderBy>