最近在做状态机工作流,刚好碰到关于任务的权限的问题。
看过听风且呤的文章 我的任务不给你看
确实不行。经过一天时间的研究,找到了方法。其实是可以的,可能在循环工作流里也行。方法如下:
public HybridDictionary TaskPermissions
HybridDictionary taskPermissions = new HybridDictionary();
taskPermissions[taskProperties.AssignedTo] = SPRoleType.Contributor;
其实上面的代码大家都看得明白,和听风且呤的写法基本是一样的,关键是以下操作。
a.在流程设计界面选择createtask 活动图标,在属性框选择SpecialPermissions为焦点(不要选择右边的"..."按钮,其实那里也没什么可以选的)。
b.点createtask 活动图标右键,选择"绑定属性'SpecialPermissions'" (出现这个选项和步骤a有关)。
c.选择在关键代码中写好的属性"TaskPermissions"。
(不用在createTask1_MethodInvoking方法中写有关SpecialPermissions的任何代码。)
源文档 <http://www.cnblogs.com/tonyjun/archive/2008/09/27/1300605.html>