We added lots of logging and try/catch blocks, but for some reason when the Event Receiver failed it would never enter the catch block, so there was no exception to log.
One key point that helped us with the troubleshooting was that we had noticed that the Event Receiver ALWAYS worked when the document was being updated through the Share Point web UI.
For example if you need to update a column or another list when a document or list item is read, this will cause en error when the user has only read access to this list or the other list.
In that case you can wrap your update code in the following construct: I’m Karine Bosch and currently I’m working as Share Point Solution Architect for Recomatics, a company located in Destelbergen near Ghent.
After the changes are saved you can activate the event handler again by executing the Enable Event Firing method on the list item.
There are different base classes from which you can inherit when developing event handlers.
You can define event handlers for the different operations on list items, like adding a list item, updating a list item or deleting a list item. Events ending by –ing are synchronous events: Item Adding, Item Updating, Item Deleting.
Asynchronous events are the events that end by –ed: Item Added, Item Updated, Item Deleted.
It appeared that the issue only occurred when the Updated event was triggered via this scheduled Power Shell script, but even then it still seemed intermittent as it would often work just fine.
We were unable to reproduce the issue at all when calling the ps1 file directly from the Power Shell console.