In SharePoint, when an item is first added to a document library, it fires the ItemAdded and ItemAdding events as expected. And if you upload the same filename to update the existing file, it will fire off ItemUpdated and ItemUpdating events, likewise as expected. However, I have been unsuccessful at determining whether this kind of action has actually occurred or not. Or, more specifically, I am entirely unable to differentiate between the following:
- An item is updated because someone uploaded a new file but did nothing to any of the form fields.
- An item is updated bec开发者_如何转开发ause someone hit "OK" but did nothing to any of the form fields.
Is there actually a way to distinguish these kinds of updates? There appears to be nothing in event properties that contains this information, nor in the version history for both the list item and the file itself. I have even tried comparing the files themselves via OpenBinary(), but in both mentioned cases I still get the same result. Thank you in advance for any help!
I went through this same problem just over 2 years ago. The way I implemented it was by looking at all the fields in the before and after properties for both event types and some of the more obscure fields were different depending on the kind of event.
Unfortunately I don't have access to that code any more so I can't give you the name of the field. Just dump all the before and after properties and play around with it.
Painful, you'd think there would be an easier way. I had hoped that during the first upload the Before Properties would be null or empty, but no such luck.
精彩评论