Hi @Frank Martin ,
The SPEventReceiverStatus.CancelNoError status is used to cancel the event without showing an error message. However, if there is an underlying issue, such as permissions or configuration problems, it might still result in an error. Check the SharePoint ULS logs for more detailed error messages that could provide additional insights.
Permissions: Ensure that the account running the event receiver has the necessary permissions to add users to the group. Lack of permissions can cause unexpected errors.
Code Adjustment: Try adjusting your code slightly to ensure the event firing is handled correctly. Here is a revised version of your code:
public override void GroupUserAdding(SPSecurityEventProperties properties)
{
base.EventFiringEnabled = false;
properties.Status = SPEventReceiverStatus.CancelNoError;
base.GroupUserAdding(properties);
base.EventFiringEnabled = true;
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.