Hi,
Based on my last project requirement i need the current logged in user's group name so that we can hide and show something on page load.
There were a lot of ways but i like the smallest way to do this.
Here it is:-
Get Current User Group (C# example)
foreach(SPGroup group in SPContext.Current.Web.CurrentUser.Groups)
{ string groupName = group.Name;
Response.Write(groupName);
}
Seems cool???
Kuldeep Kadyan
Tuesday, July 14, 2009
Subscribe to:
Post Comments (Atom)
2 comments:
Hi, after opening the list in sharepoint designer,where in the code do we put these lines?????
I need to hine a column based on the user's group.
Thanks
Hi,
This is c# code. So you need to put this in web part.
Other option is to use c# script in your page the you can use the same code using the SP designer.
Thanks
Kuldeep Kadyan.
Post a Comment