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.However i cant get the workflow histroy from there, thanks.
preguntado el 08 de noviembre de 11 a las 14:11
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
TaskListId propiedades (see the SPWorkflow doc).
So basically something like this should work:
SPListItem item = tasklist; SPWorkflow workflow = item.Workflows; 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  but get the workflow you really want (e.g. by knowing its name).