How do I distinguish between a SharePoint file update and a file upload?
In SharePoint, when an item is first added to a document library, it fires the ItemAdded and ItemAdding events as expected. And if you load the same filename to update an existing file, it will reset the ItemUpdated and ItemUpdating events as well as expected. However, I have not been successful in determining whether this action actually happened or not. Or, more specifically, I am completely unable to distinguish between the following:
- The element is being updated because someone uploaded a new file, but did nothing for any of the form fields.
- The item is being updated because someone clicked OK but did nothing for any of the form fields.
Is there a way to tell the difference between these updates? There is nothing in the event properties that contains this information, nor in the version history for either the list item or the file itself. I even tried to compare files using OpenBinary (), but in both cases, I still get the same result. Thank you in advance for your help!
source to share
I went through this same issue a little over 2 years ago. The way I implemented it was to look at all property fields before and after both event types, and some of the more obscure fields were different depending on the event type.
Unfortunately, I no longer have access to this code, so I cannot give you the field name. Just reset all the before and after properties and play with it.
Painfully, you would think there would be an easier way. I was hoping that during the first boot, the Before Properties function would be empty or empty, but will fail.
source to share