- First Group By is not working (however the second file subcategory Group By works)
- The OrderBy is not working
- Show all items without folder is not working
Any ideas??
private static void CustomView(SPWeb web, SPList spList)
{
SPViewCollection oViewCollection = spList.Views;
string strViewName = "Custom_View";
System.Collections.Specialized.StringCollection viewFields = new System.Collections.Specialized.StringCollection();
viewFields.Add("File Type");
viewFields.Add("Name");
viewFields.Add("File Date");
viewFields.Add("File Number");
//string strQuery = "<OrderBy><FieldRef Name=\"LinkFilenameNoMenu\" /></OrderBy>"; //works
string strQuery = "<GroupBy Collapse=\"TRUE\" GroupLimit=\"100\">" +
"<FieldRef Name=\"File Category\"/>" +
"<FieldRef Name=\"File Subcategory\"/>" +
"</GroupBy>" +
"<OrderBy>" +
"<FieldRef Name=\"LinkFileName\"/>" +
"</OrderBy>";
oViewCollection.Add(strViewName, viewFields, strQuery, 100, true, true);
spList.DefaultView.Update();
spList.Update();
SPView view = spList.Views["Front_Page"];
view.Scope = SPViewScope.Recursive;
spList.Update();
}