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

  • The question can be closed. The event was fired correctly but the debugger was not attached to the correct process. – Frank M. Aug 22 '18 at 12:22
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, privacy policy and cookie policy

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