SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have created a custom approval workflow. The approval task is assigned to user A. But sometimes user B would open the task and approve it. As you can see by the screenshot it says who was assigned (user A) and who actually approved it (user B).

How can we programmatically (C#) get both accounts used for approval?

Screenshot from Workflow history

share|improve this question
up vote 1 down vote accepted

I presume you mean the AssignedTo and the ModifiedBy? Assigned to is the assigned user, and when you approve a task it gets put into Modified By.

You get them like:

SPListItem task = taskList.Items.GetItemById(taskID);
string modifiedby = task["Modified By"].ToString();
string assignedto = task["Assigned To"].ToString();

If you want to do something that stores just the Approver, then you will need an event handler or the akin on updating that sets a custom column if the approval has changed.

share|improve this answer

I ended up using a local variable from the Approval task, which contains "Modified by". Then I added a property to my custom workflow action. The property was set by using the variable from the workflow.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.