如何在 MS Sharepoint 中访问工作流程的历史记录结果?
我目前正在使用 Microsoft Visual Studio 为 MS Sharepoint 创建 Web 部件。请问如何访问实施工作流程的库/列表以获取工作流程历史记录和完成后的结果?
目前我有代码来访问各个字段,即获取列表的不同列:
SPSite site = new SPSite("http://win7:8000/RIDepartment/");
SPWeb oweb = site.OpenWeb();
SPList tasklist = oweb.Lists["Innovation workflow list"];
然后为了获取第一项,我使用任务列表[0]。但是我无法从那里获取工作流程历史记录,谢谢。
梅尔文
i m currently using Microsoft Visual Studio to create a webpart for MS Sharepoint. May i ask how do i access the Libraries/List where a workflow is implemented to get the Workflow History and Outcome when it is completed?
Currently i have codes to access the individual fields, which is to get the list's different column:
SPSite site = new SPSite("http://win7:8000/RIDepartment/");
SPWeb oweb = site.OpenWeb();
SPList tasklist = oweb.Lists["Innovation workflow list"];
then to get the first item, i use tasklist[0].However i cant get the workflow histroy from there, thanks.
Melvin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请查看各种工作流程教程 https:// www.google.com/search?q=sharepoint+2010+workflow+tutorial+c%23
您需要通过
SPListItem.Workflows
获取列表项上的工作流程。从返回的SPWorkflowCollection
中获取正确的SPWorkflow
后,您可以通过HistoryListId
和TaskListId< 获取相关的历史列表和任务列表/code> 属性(请参阅 SPWorkflow文档)。
所以基本上类似这样的东西应该可以工作:
但是这个代码非常糟糕,所以只需使用它作为起点,你也不应该使用 [0] 但获得你真正想要的工作流程(例如通过知道它的名称)。
Please take a look at the various workflow tutorials https://www.google.com/search?q=sharepoint+2010+workflow+tutorial+c%23
You will need to get the workflow on your list item via
SPListItem.Workflows
. Once you get your correctSPWorkflow
from the returnedSPWorkflowCollection
you can get the related history list and task list via theHistoryListId
andTaskListId
properties (see the SPWorkflow doc).So basically something like this should work:
However this code pretty much sucks so just use it as a starting point, also you shouldn't use [0] but get the workflow you really want (e.g. by knowing its name).