SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPWeb theSite = SPControl.GetContextWeb(Context);
SPUser theUser = theSite.CurrentUser;
string CurrentUserLoginName = theUser.LoginName;
string siteUrl = SPContext.Current.Web.Url;
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.OpenWeb())
{
SPGroupCollection groupCollection = web.SiteGroups;
foreach (SPGroup group in groupCollection)
{
SPUserCollection userCollection = group.Users;
string GroupName = group.LoginName;
if (GroupName == GrpName)
{
foreach (SPUser user in userCollection)
{
string UserName = user.LoginName;
if (UserName == CurrentUserLoginName)
{
}
}
}
}
}
}
});
No comments:
Post a Comment