In an event receiver, is it necessary to call base.ItemAdding(properties);, base.ItemUpdating(properties);, etc. at the beginning of your event handler?

I've seen people arguing that it isn't necessary because it doesn't do anything, but it seems to be in an awful lot of code samples.

1 Answer 1


So I was intregued as to the actual answer as I have always left it in. I guess one of the reasons why is that I think its good practice and hasn't caused me any problems. This plus Visual Studio puts it in when you override the function.

However, it looks like you should leave it in as when reflected this is what's implemented underneath:-

public virtual void ItemAttachmentAdded(SPItemEventProperties properties)

which calls into the function BaseItemEventReceiver(properties) which looks like this:-

private void BaseItemEventReceiver(SPItemEventProperties properties)
   if (properties == null)
     throw new ArgumentNullException("properties");
   properties.Status = SPEventReceiverStatus.Continue;

I would suggest from the code in BaseItemEventReceiver() that you should call the base class function first to validate the SPItemEventProperties object before going through your code.

  • 5
    It's interesting though that if the properties are null that it doesn't set the Status property to CancelWithError while providing an ErrorMessage, rather than throwing an ArgumentNullException. So I suppose if you wanted to handle this more elegantly you could just check for a null reference yourself, rather than calling the base method. Feb 8, 2013 at 14:54

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.