0

I've added a GroupUserAdded event receiver to a SPWeb and confirmed the correct deployment via SharePoint Manager.

Additionally, the call to the receiver class is working fine when adding a user via SP Site Settings page People and Groups.

The caveat I'm experiencing right now - and couldn't find a fix for - is that programmatically adding a user to a group as follows won't trigger the event receiver. Any idea as though why this behaviour occurs would be appreciated.

var firstGroup = web.SiteGroups[0];
var adminUser = web.EnsureUser("administrator");
firstGroup.AddUser(adminUser);
firstGroup.Update();

ty, Frank

1
  • The question can be closed. The event was fired correctly but the debugger was not attached to the correct process.
    – Frank M.
    Aug 22, 2018 at 12:22

1 Answer 1

0

Try adding System.Threading.Thread.Sleep(1000); after the Update. Sometimes async events are not triggering properly.

Similar case but with item event receiver: Programmatically changing a field won't trigger the event receiver

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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