Loading...

Tuesday, August 16, 2011

Check if current user is member of Sharepoint Group in Elevated Privileges Code Block

SPUserToken userToken = SPContext.Current.Web.CurrentUser.UserToken;

SPSecurity.RunWithElevatedPrivileges(delegate()

{

using (SPSite site = new SPSite(weburl, userToken))

{
using (SPWeb web = site.OpenWeb())

{

SPGroup group = web.SiteGroups[];


if (!web.IsCurrentUserMemberOfGroup(group.ID))

{

}

No comments: