SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 13 down vote accepted

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.

share|improve this answer
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. – RJ Cuthbertson Feb 8 '13 at 14:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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