是否可以通过编程方式将共享点列表视图创建为甘特图视图?

发布于 2024-11-27 05:28:32 字数 974 浏览 1 评论 0原文

是否可以通过编程方式将共享点列表视图创建为甘特图视图?我以编程方式创建了列表视图,参考下面的代码

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海夜未眠 2024-12-04 05:28:32

您与这里所拥有的非常接近。在将视图添加到 SPViewCollection 的行中,您需要使用不同的重载方法。方法选项列表位于此处。您需要包含 SPViewCollection.SPViewType 类型的类型。这条线应该看起来像这样。

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

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文