Current user in workflow

LogiMes
LogiMes used Ask the Experts™
on
Is it possible to retrieve the current user of a workflow.
i have tried: workflowProperties.OriginatorUser but it's only giving me the user started the workflow not the user running it.

It a multiapproval workflow. I want to log to the history if a user make any comments to a document approval. The username on the user making the comment should be shown in the History List.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jamie McAllisterCloud Expert
Most Valuable Expert 2013
Top Expert 2014

Commented:

Author

Commented:
But the i get the username as a string. But how do i get it as a SPmember??
I want to make the log in a history list and that required the username as a SPMember:
workflowProperties.Workflow.CreateHistoryEvent((int)SPWorkflowHistoryEventType.WorkflowComment, 0, workflowProperties.OriginatorUser, "", "Approved with comments: " + feedbackStep, "");


Cloud Expert
Most Valuable Expert 2013
Top Expert 2014
Commented:
SPMember owner = rootWeb.Users["SomeUserName"];
SPUser user = rootWeb.Users["SomeUserName"];
Commented:
might be better to use rootWeb.EnsureUser("username") as that way you are certain that he will exist in that site
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spweb.ensureuser.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial