Question

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

Was it helpful?

Solution

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

OTHER TIPS

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.

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

SP.ListItem.file A sample code is mentioned here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top