Get Login of Sharepoint User in Workflow 7
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