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


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


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.


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

SP.ListItem.file A sample code is mentioned here

  • I thought ListItem was null on the ItemAdding Event? – John Jul 16 '12 at 13:17

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.