SPWeb web = SPContext.Current.Web;
SPList list = web.Lists["My List"];
SPViewCollection allListViews = list.Views;
string viewName = "My New View";
StringCollection newviewFields = new StringCollection();
viewAllContactFields.Add("Edit");
viewAllContactFields.Add("LinkTitleNoMenu");
viewAllContactFields.Add("Field1");
viewAllContactFields.Add("Field2");
viewAllContactFields.Add("Field3");
string myquery = "<OrderBy><FieldRef Name='LinkTitle' Ascending='TRUE' /><FieldRef Name='EffectiveDate' Ascending='TRUE' /></OrderBy>";
allListViews.Add(viewName, newviewFields, myquery, 30, true, false);
SPList list = web.Lists["My List"];
SPViewCollection allListViews = list.Views;
string viewName = "My New View";
StringCollection newviewFields = new StringCollection();
viewAllContactFields.Add("Edit");
viewAllContactFields.Add("LinkTitleNoMenu");
viewAllContactFields.Add("Field1");
viewAllContactFields.Add("Field2");
viewAllContactFields.Add("Field3");
string myquery = "<OrderBy><FieldRef Name='LinkTitle' Ascending='TRUE' /><FieldRef Name='EffectiveDate' Ascending='TRUE' /></OrderBy>";
allListViews.Add(viewName, newviewFields, myquery, 30, true, false);
No comments:
Post a Comment