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

I need to add a specific behavior in the ItemAdding event when the item added is a document, but I noticed that when using the "Upload document" or the "Upload Multiple Documents" features in Sharepoint 2010, properties.Afterproperties["ContentType"] and properties.Afterproperties["ContentTypeId"] are null. So my question is simple, is it safe then to assume that the item being added is a document? and if not, then how can I find out if it is a document?

Thanks! Alex

share|improve this question
up vote 0 down vote accepted

You can have a look at the List property, then detect if the event is occuring in a document library.

share|improve this answer
Thanks! I believe that should work just fine. – Alex Aug 16 '12 at 14:03

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.