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