¿Cómo acceder al resultado del historial de un flujo de trabajo en MS Sharepoint?

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

preguntado el 08 de noviembre de 11 a las 14:11

1 Respuestas

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 correct SPWorkflow desde el devuelto SPWorkflowCollection you can get the related history list and task list via the HistoryListId y TaskListId propiedades (see the SPWorkflow doc).

So basically something like this should work:

SPListItem item = tasklist[0];
SPWorkflow workflow = item.Workflows[0];
SPList historyList = workflow.HistoryList;
SPList taskList = workflow.TaskList;

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).

respondido 08 nov., 11:19

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.