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;
//代码
// 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);
你可以找到更多的代码SAM普莱斯在这里: Tim Byrne's blog re: K2
出几十可用的命名空间的API中的,在使用中最常见的命名空间(顺便说一句,该公司的名称是SourceCode):
> Sourcecode.Workflow.Client
> SourceCode.Workflow.Management
> SourceCode.SmartObjects.Client
希望帮助。
嗨sherif,谢谢你的回应。我会检查这个解决方案。 :) – janejanejane 2010-12-12 14:41:50