【问题标题】:Listing Nintex Workflow Tasks across a site collection跨网站集列出 Nintex 工作流任务
【发布时间】:2014-03-03 03:42:23
【问题描述】:

我正在开发一个将批准选定的 Nintex 工作流任务的 SharePoint Web 部件。这将是列出 Nintex 工作流程任务的简单表格(需要批准的复选框)。有没有人有一个如何在网站集中获取 Nintex 工作流任务的示例?我想 CAML 查询将用于此。

谢谢,

雅库布

【问题讨论】:

  • 你想实现这个 OOTB 还是通过编写自定义 webpart?
  • 您好,通过编写自定义 webpart。
  • 您的网站集是否有多个子网站,您必须从中聚合任务?
  • 是的,这就是我的情况。

标签: sharepoint web-parts caml nintex-workflow


【解决方案1】:

由于您必须从网站集中的不同子网站获取任务,因此您必须使用SPSiteDataQuery。您可以将列表模板用于工作流任务,并将网站范围指定为“SiteCollection”,因为您需要来自所有子站点的任务。您可以编写您的 caml 查询条件来过滤掉任务。

SPSiteDataQuery query = new SPSiteDataQuery();

               // Query all Web sites in this site collection.
               query.Webs = "<Webs Scope=\"SiteCollection\">";
//Ask for all lists created from the tasks template.
               query.Lists = "<Lists ServerTemplate=\"107\" />";

这是所有列表模板 ID 的列表 http://mirusp2010.blogspot.in/2013/03/list-template-id.html

如果您为类创建了自定义列表模板,则可以指定该 ID。SPSiteDataQuery 返回的数据表将包含有关此任务来自的子站点、任务 ID 等的信息。您可以使用复选框以显示任务并添加功能以批准该任务。

【讨论】:

    【解决方案2】:

    至少可以考虑两种方法来实现 Web 部件

    基于查询的 Web 部件

    由于范围是网站集,因此应使用SPSiteDataQuery class

    示例:从站点集合返回 Nintex 任务

            /// <summary>
            /// Retrieve Nintex Tasks from site collection  
            /// </summary>
            /// <param name="siteUrl"></param>
            /// <returns></returns>
            public static DataTable GetNintexTasksResult(string siteUrl)
            {
                using (var site = new SPSite(siteUrl))
                {
                    SPSiteDataQuery query = new SPSiteDataQuery();
    
                    query.Lists = "<Lists ServerTemplate=\"107\" />";
                    query.Query = "<Where>" +
                                  "   <Or>" +
                                  "      <Eq>" +
                                  "         <FieldRef Name='ContentType' />" +
                                  "         <Value Type='Text'>Nintex Workflow Task</Value>" +
                                  "      </Eq>" +
                                  "      <Eq>" +
                                  "         <FieldRef Name='ContentType' />" +
                                  "         <Value Type='Text'>Nintex Workflow Multi Outcome Task</Value>" +
                                  "      </Eq>" +
                                  "   </Or>" +
                                 "</Where>";
                    query.Webs = "<Webs Scope=\"SiteCollection\" />";
    
                    return site.RootWeb.GetSiteData(query);
                }
            }
    

    基于搜索的 Web 部件

    步骤:

    • 您需要在搜索中创建自定义托管属性 映射到爬网属性的服务应用程序 ows_ContentType

    • 然后可以构造关键字查询:ContentTypeName:"Nintex Workflow Multi Outcome" OR ContentTypeName:"Nintex Workflow Task"

    详情请咨询Building Search Queries

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多