从任务项获取SharePoint 2010工作流 [英] get SharePoint 2010 Workflow from Task item

查看:73
本文介绍了从任务项获取SharePoint 2010工作流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#构建一个Web部件,它将在Sharepoint网站集中获得所有未完成的任务.我使用CAML查询从状态=未开始"的任务列表中返回所有项目.从这里,我将需要链接回开始此任务的工作流,并从那里获得工作流的内容类型以及所有相关字段.

有人有任何示例代码可以做到这一点吗?我已经看到了从具有关联工作流程的列表项中访问任务项列表的代码,但是我还没有看到如何从任务项列表中获取工作流.

谢谢

I am building a web part in C# that will get all outstanding tasks in a sharepoint site collection. Using a CAML query I am returning all items from a task list where the status = "Not Started". From here I will need to link back to the workflow that started this task and from there get the content type of the workflow with all of the associated fields.

Does anyone have any sample code to do this? I''ve seen code to get to the task item list from a list item that had an associated workflow, but I haven''t seen how to get the workflow from the task item list.

Thanks

推荐答案

您可以使用
You can use the Workflows[^] of the SPListItem. From there you can access the properties of SPWorkflow object necessary


在listItem对象中,有一个名为"WorkflowInstanceID"的字段.一旦有了,您就可以创建一个引用该ID的新SPWorkFlow对象,

SPWorkflow工作流程实例=新的SPWorkflow(oWeb,workflowInstanceId);


完成后,您可以转到通过
链接到的列表
SPList itemList =工作流实例.父母列表;

从那里我可以得到所需的一切.
Within the listItem object there is a field called "WorkflowInstanceID". Once you have that you can create a new SPWorkFlow object referencing that ID,

SPWorkflow workflowInstance = new SPWorkflow(oWeb, workflowInstanceId);


Once that is done you can go the list it is linked to via

SPList itemList = workflowInstance.ParentList;

From there I was able to get all I needed.


这篇关于从任务项获取SharePoint 2010工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆