mercredi 3 décembre 2014

Client object model: orderby in camlquery doesn't work



I have a list on SharePoint 2010: (only showing the first item)


enter image description here


How can i get that list alphabeticly? I use a camlquery to try this but it doesn't work. I do get the list but it is in a random order. Am I doing something wrong?



List oList = clientContext.Web.Lists.GetByTitle(listTitle);
CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = @"<View><Query><OrderBy><FieldRef Name='DisplayName'/></OrderBy></Query></View>";

ListItemCollection listItems = oList.GetItems(camlQuery);
clientContext.Load(
listItems,
items => items.Include(
item => item.DisplayName,
item => item["WikiField"]));
clientContext.ExecuteQuery();







0 commentaires:

Enregistrer un commentaire