2
是否可以通過編程方式創建SharePoint列表視圖作爲Gant圖表視圖?我創建列表視圖編程是否可以通過編程方式創建SharePoint列表視圖作爲Gant圖表視圖?
var web = (SPWeb)properties.Feature.Parent;
SPList list = web.GetList(SharedDocumentListUrl);
SPViewCollection allviews = list.Views;
string viewName = "Document Review Summary";
System.Collections.Specialized.StringCollection viewFields = new System.Collections.Specialized.StringCollection();
viewFields.Add(EYWorkProductIndicator);
viewFields.Add(EYPaperProfile);
viewFields.Add(DocIcon);
string myquery = "<Where><Eq><FieldRef Name='Status' /><Value Type='Choice'>In Review</Value></Eq></Where>"
+ "<OrderBy><FieldRef Name='LinkFilename' Ascending='True' /></OrderBy>";
SPView customView = allviews.Add(viewName, viewFields, myquery, 100, true, false);
customView.XslLink = "eymain.xsl";
customView.Update();