惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 皮皮@北京

自定义MOSS搜索框 最牛比的IE。。 微软于周一正式公布了下一个版本的SharePoint服务器版本的初步系统要求 讨厌的K2变化ProcessInstance.DataFields - 皮皮@北京 - 博客园 安装SQL Server 2008 及 VS 2008(转自邹建老大的blog) Windows SharePoint Services 3.0 通用参考中文版 Microsoft Office SharePoint Server 2007 通用参考中文版 避免Webpart Page的URL地址中带ID参数的问题 用js改变MOSS自带的一些按钮的默认事件 [转]大学厕所里爆笑接龙(好久没更新了啊。。) 解决:K2.net Studio 遇到问题需要关闭 K2 BlackPearl中日志记录的设置与扩展 The Sharepoint 2007 Song WorkflowManagementHostServer Not Hosted! 用ddwrt:URLLookup在列表自定义页面中显示查阅项的链接 SharePoint Permissions Matrix 记录中心设置 如何给SPListItem中DateTime类型的Field赋空值 巨爆笑~
K2中的任务代理
皮皮@北京 · 2009-03-14 · via 博客园 - 皮皮@北京

K2现在的最新版本0807已经有了任务的代理功能,称之为Out-Of-Office,但是此版以前的版本都是没有提供的,而在我们所做的项目中一般都有这个需求,在这里我不会继承传统习惯把代码发出来,而是把我实现此功能的思路和核心的几句代码说一下,明白人会轻而易举的写出来(恩。。其实我也不是好人。。)。核心的代码如下:

Code

1) 先使用DeleteOutdateDelegation方法清除已经过期的代理信息(select 需要的字段 from 表 where 已过期)。

2) 使用GetDelegationList方法获取有效的代理信息(select 需要的字段 from 表 where 有效的)。

3) 循环判断每项代理信息的代理人和被代理人,模拟代理人将代理人的任务转发给被代理人,然后给被代理人发送邮件。

做过K2的知道,WorkflowManagementServer中有一个任务转移的方法RedirectWorklistItem(destination, "K2:" + to, procInstId, actInstDestId, itemID),我们一开始就是用的这个来实现转向,不过我们在项目进行中发现这个方法有时候有效有时候却没有效果,后来我用模拟用户然后用客户端的WorklistItem的Redirect来实现这个功能,使用正常。

这个模拟的类也很简单,代码在这里:

 1public class Impersonation : IDisposable
 2{
 3  private Connection _conn = null;
 4  private Impersonation(Connection conn)
 5  {
 6    _conn = conn;
 7  }

 8  public static Impersonation Impersonate(string userName, Connection conn)
 9  {
10    conn.ImpersonateUser(userName);
11    return new Impersonation(conn);
12  }

13  public void Dispose()
14  {
15    _conn.RevertUser();
16  }

17}

GetDelegationList和DeleteOutdateDelegation是对存储数据的执行,比如SQL,我们的项目一般是MOSS+K2的,所以我们的数据一般就存在MOSS的列表里。

就这么简单。当然有的东西有不一样的需求,比如有的客户只需要代理就可以了,有的客户还需要针对流程针对时间段代理,这些我们都可以很容易的实现,SQL语句罢了。

将这些代码放在一个自动执行的程序里就OK,比如Windows Services,当然象MOSS项目可以将他做到MOSS的计划任务里。