0

In CS file I used this code and it's worked:

  SPWeb site = SPContext.Current.Web;
        int managerGroup = site.Groups["Właściciele witryny Main"].ID;
        if (site.IsCurrentUserMemberOfGroup(managerGroup))

How use in event receiver? Please help.

  • 1
    To get the spweb you can use properties.web; – user13186 Jan 9 '13 at 14:45
1

I done this like the same method but with direct url:

        public bool sprawdzanieUserow()
    {
        SPSite oSiteCollection = new SPSite("http://aaaa/");
        SPWeb site = oSiteCollection.RootWeb;
        int managerGroup = site.Groups["Właściciele witryny Main"].ID;
        if (site.IsCurrentUserMemberOfGroup(managerGroup))
        {
            return true;
        }
        return false;
    }
-2

'After' Event receivers are launched by system account and therefore you cannot get the current user from its context.

You should check these : http://social.msdn.microsoft.com/Forums/en/sharepointdevelopmentlegacy/thread/53c64bb1-6810-48ac-910a-9faa16c8e3b9

How to get current logged user in event receivers?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.