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

2 comments:

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

    Thanks
    Shaffi.A

    ReplyDelete
  2. Anonymous2:28 am

    Thank you very much for this!

    ReplyDelete