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 have a document library. I want to add an itemadding event recieiever to do some validation on the file name of the document. How can I get the file name from the SPItemEventProperties

share|improve this question
up vote 1 down vote accepted

The ListItem is not available in ItemAdding. This won't work.

share|improve this answer

You can use


and then split it by "/" and get the second part of string to get document Name, it does work for item adding or item updating.

share|improve this answer

You need to use SP.ListItem.get_file();

SP.ListItem.file A sample code is mentioned here

share|improve this answer
I thought ListItem was null on the ItemAdding Event? – John Jul 16 '12 at 13:17

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.