Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
What to do when you want to determine the current user in a workflow? It’s possible that the workflow runs inside the w3wp.exe worker process, in which case the current user makes sense. But it’s also possible that a workflow runs inside the owstimer.exe process, at a later time. In these cases, the current user doesn’t make sense. Instead, use the workflow originator or initiator.
To get the e-mail address of the originator user:
- workflowProperties.OriginatorUser.Email Or workflowProperties.OriginatorEmail
To get the display name of the originator user:
- workflowProperties.Originator Or workflowProperties.OriginatorUser.Name
To get the login name (format [domain name]\user name]:
- workflowProperties.OriginatorUser.LoginName
These techniques can be used in workflows that are created programmatically. In a SPD (no-code) workflow, you can also retrieve the workflow initiator’s e-mail address: use the User Profile web service as a data form web part in the .aspx page of the workflow to get the e-mail address whenever the initiator started the workflow.
Thanks to http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/a5c5094c-5578-4e3c-83f2-62308f9f946f/ for the info.
Please note: Also check out the SharePoint 2010 Best Practice Overview page at http://social.technet.microsoft.com/wiki/contents/articles/8666.sharepoint-2010-best-practices-en.aspx