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 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
# re: How to get the current user logged into Sharepoint
Gravatar 完全無料セフレのミルク<br />安心確実!出会いのミルフィーユ
Left by 出会い系サイト on 3/4/2009 2:58 AM
# wow gold
Gravatar buy wow gold,cheap wow gold,wow power leveling.
Left by wowgold on 3/27/2009 9:18 PM
# wow gold
Gravatar Our selection ofwow gold bean bags
Left by zhuqian on 4/15/2009 10:45 PM
# re: How to get the current user logged into Sharepoint
Gravatar good , i like it

this post helps me

sharepoint is a good product
Left by darkfall gold on 6/22/2009 10:53 AM

Leave Your Comment

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

Preview Your Comment.