开发者

Is that possible to create sharepoint list view as gant chart view programically?

Is that possible to create sharepoint list view as gant chart view programically? I created list view programically refer below code

         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();


You are pretty close with what you have here. In your line where you add the view to the SPViewCollection, you need to use a different overload method. The list of method options is here. You need the one that includes the SPViewCollection.SPViewType type. This line should look something like this.

 SPView customView = allviews.Add(viewName, viewFields, myquery, 100, true, false, SPViewCollection.SPViewType.Gantt, false);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜