K2流程取消

jan*_*ane 3 c# sharepoint k2

我被分配了一个关于K2 Blackpearl的任务,涉及以编程方式直接停止某些工作项的过程而不使用产品的界面,因为它不能达到目的.

问题在于,在此业务需求中,特定的支持者可以通过创建自定义应用程序来从多个文档上载,该自定义应用程序从excel文件中读取行并自动上载到K2.

此解决方案的开发人员不再存在,他们的工作细节不可用.

我刚刚被告知可以使用自定义控制台应用程序停止进程.

有人可以教我正确的道路吗?我之前没有K2的经验,所以这对我来说是一项艰巨的任务,因为我对它的流程并不熟悉.

小智 8

K2 API有很好的文档,可以从K2井下载示例代码和演示应用程序.

你的问题的答案在这里:k2underground.com/forums/p/12082/35429.aspx

我已经拿出相关的代码行:

//引用

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SourceCode.Workflow.Management;
using SourceCode.Hosting.Client.BaseAPI;
Run Code Online (Sandbox Code Playgroud)

//代码

// connection string
SCConnectionStringBuilder scBuilder = new SCConnectionStringBuilder();
scBuilder.Authenticate = true;
scBuilder.IsPrimaryLogin = true;
scBuilder.Integrated = true;
scBuilder.Host = "localhost";
scBuilder.Port = 5555;

// connect to K2 Server
WorkflowManagementServer wfmServer = new WorkflowManagementServer();

wfmServer.CreateConnection();
wfmServer.Connection.Open(scBuilder.ConnectionString);

// optionally get a list of process instances to explore
/*
ProcessInstances procInst = 
  wfmServer.GetProcessInstancesAll(string.Empty, string.Empty, string.Empty);
*/

// when you've got a proc inst you're interested in, stop it.
int _procInstId = 123; // get this from your process instance context
wfmServer.StopProcessInstances(_procInstId);
Run Code Online (Sandbox Code Playgroud)

您可以在此处找到更多代码示例: Tim Byrne的博客:K2

在API中的几十个可用命名空间中,最常用的命名空间是(顺便说一下,公司的名称是SourceCode):

> Sourcecode.Workflow.Client
> SourceCode.Workflow.Management
> SourceCode.SmartObjects.Client
Run Code Online (Sandbox Code Playgroud)

希望有所帮助.