I am trying to catch event (ItemUpdating) when user just replaces the content of a document without explicitly checking out/in. I have checked all the differences on BeforeProperties and AfterProperties. I was hoping that vti_sourcecontrolversion or vti_timelastmodified would change, but first one stays the same and the other is null in AfterProperties. Any advice?
1 Answer
If the data's not present in the properties object you can query the document and look in its version history. That's about the only other option you have.
-
Good advice, thank you. If I understand correctly, this should be done in ItemUpdated, after update is executed. If the new version is created in latest few seconds, this would be the event. I am a little concerned that this event may be caught many times within that time if item is updated in some other way than creating a new version. Or is there another way?– FurliAug 5, 2021 at 7:16
-
If I were you, I'd step back and look at the business problem you're trying to solve and try to figure out if there's a better way to solve it. Running code to inspect a document's contents every time it's updated, if it's updated frequently, is going to be a mess. Aug 5, 2021 at 13:29
-
After implementing the proposed solution, I have noticed that new version gets created on every change of properties of a document too. In my case, it was more appropriate to check folder last modification date. This one changes on every change in files within.– FurliAug 9, 2021 at 9:32