When restoring an item (specifically a document back to a document library) I need to be able to conditionally stop the restore from occuring. Let me tell you why...
Say I have a doc lib with a custom column on. The column is of type datetime. The value in the column has to be unique. To do this I have an event receiver on itemupdating which runs a simple CAML query on the list to check that the value I provide is not
being used elsewhere. If this test passes the update occurs, if not I do a properties.ErrorMessage="Column must contain a unique value" and a properties.Cancel=true. Simple.
My problem is, say someone uploads a document, doc A, and gives it the date 01/01/2011. If I try and upload document B with the same date it will stop me - good. However if document A is deleted and I add my document B with 01/01/2011 it will allow that
- still good as nothing in the doc lib has that date. The problem now would be if someone restored document A back to the library document A and B would both have the date 01/01/2011. Not good.
I've had a look at the event receivers and the SPItemEventProperties object when a restore is performed and both adding and added fire. During adding there doesn't seem to be any of the original list item meta data available for me to interogate? During
itemadded I can see the values on the SPListItem contained within the SPItemEventProper
View Complete Post