Monday, August 03, 2009

Function to read List Item Id based on task

taskListItemId = id of task item

web = Web object

SPListItem taskItem = taskList.GetItemById(taskListItemId);
Guid workflowInstanceId = new Guid((string)taskItem["WorkflowInstanceID"]);
SPWorkflow workflowInstance = new SPWorkflow(web, workflowInstanceId);
SPList itemList = workflowInstance.ParentList;
SPListItem parentListItemId = itemList.GetItemById(workflowInstance.ItemId);


Shaffi said...

Hi Sanjay,

Thanks for the psoting. actualyl my requirement was getting the list of workflow tasks using a List item Id, but I derived it from the fucntion that you have provided here.


Anonymous said...

Thank you very much for this!