2014-10-29 73 views

回答

1

如何設置閱覽通過CSOM排序:

var pagesList = ctx.Web.Lists.GetByTitle("Pages"); 
var view = pagesList.DefaultView; 
view.ViewQuery = CreateOrder("Title",true); 
view.Update(); 
ctx.ExecuteQuery(); 


public static string CreateOrder(string fieldName, bool ascending) 
{ 
    return string.Format("<OrderBy><FieldRef Name=\"{0}\" Ascending=\"{1}\" /></OrderBy>", fieldName, ascending ? "TRUE" : "FALSE"); 
} 
相關問題