0

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

谢谢,

雅库布

4

2 回答 2

1

对于 Web 部件实现,至少可以考虑两种方法

基于查询的 Web 部件

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

示例:从站点集合返回 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 部件

脚步:

  • 您将需要在您的 Search Service 应用程序中创建一个自定义托管属性以映射到已爬网的属性 ows_ContentType

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

有关详细信息,请参阅构建搜索查询

于 2014-03-04T00:35:51.853 回答
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 等的信息。您可以创建一个带有复选框的自定义控件以显示任务并添加功能以批准该任务。

于 2014-03-03T20:34:54.513 回答