How to get the current user logged into Sharepoint

the following snippet get 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" ;

 

 

 

 

 

str +=

str +=

str +=

 

 

str +=

}

lblInfo.Text = str;

}

 

lblInfo.Text=

}

Comments

# re: How to get the current user logged into Sharepoint
Gravatar execellent!!!!
Left by smartyme on 8/14/2008 5:20 PM
# re: How to get the current user logged into Sharepoint
Gravatar When I firstLineage adena faculty meetingLineage 1 adena of the year, as a newSilkroad gold teacher my first ever,buy silkroad gold and this man was my principal.heflyff penya stood at the frontbuy flyff gold of the room,flyff money hands on hips,eve online isk and faced us alleve isk as if we were prisoners.2moons dil "Keep in mind2moons gold that I'm the boss,"eq2 plat he said. "You willEverQuest 2 gold do as you are told,EverQuest 2 plat and if you don't,Runescape gold I'll make your lives miserable!"FreshRunescape money out of college, I had accepted the position of kindergarten teacher at a public school.
Left by BGG on 11/19/2008 6:09 AM
# re: How to get the current user logged into Sharepoint
Gravatar She cried in world of warcraft goldmy arms and saidbuy wow gold she didn't want thecheap wow gold surgery. I held herwow power leveling hand as an I.V.
Left by BGG on 11/19/2008 6:10 AM
# re: How to get the current user logged into Sharepoint
Gravatar In a few seconds herwow power leveling tears stopped and she closed those eyesbuy wow gold that had always seemed so clever and clear.
Left by BGG on 11/19/2008 6:11 AM

Leave Your Comment

Title*
Name*
Email (never displayed)
 (will show your gravatar)
Url
Comment*

Please add 1 and 6 and type the answer here:

Preview Your Comment.