Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

Get Login of Sharepoint User in Workflow 7

Created: 05 Jul 2011
BenS's picture
0 0 Votes
Login to vote

I have looked up how to get the login user of a sharepoint session (not the login on the computer) with the following:

 

the following snippet gets the current user lgged into Sharepoint and displays his/her Name, Login name, Email and all the groups he/she belongs to.

try {SPWeb web = SPControl.GetContextWeb(Context);SPUser sUser = web.CurrentUser; string str = "Name:" + sUser.Name + "<BR>"; "Login Name :" + sUser.LoginName + "<BR>"; "Email:" + sUser.Email + "<BR>"; "Groups:" + sUser.Groups.Count + "<BR>"; foreach (SPGroup grp in sUser.Groups) { " * " + grp.Name + " total Members:" + grp.Users.Count + "<BR>"; catch (Exception ex) { "No Current User" ;

Two questions for anyone:

1) Would this code work by itself within workflow?

2) Where exactly can I add this code - integration project+

Thanks