Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.