Hi @john john,
The following code snippet will prevent item deletion and also notify the user of what happened
public override void ItemDeleting(SPItemEventProperties properties)
{
base.ItemDeleting(properties);
properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = "This item cannot be deleted; Contact your administrator";
}
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.