Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
1  
To get the spweb you can use properties.web; –  user13186 Jan 9 '13 at 14:45

2 Answers 2

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;
    }
share|improve this answer

'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?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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