0

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

3 Answers 3

1

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

0

You can use

Properties.AfterUrl

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.

-1

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

SP.ListItem.file A sample code is mentioned here

1
  • I thought ListItem was null on the ItemAdding Event?
    – John
    Commented Jul 16, 2012 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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