Unfortunately, that makes your project like the Titanic.I don’t mean that it’s largest and most luxurious application every written, but rather that you may be cruising headlong into a nasty rendezvous with an iceberg that could deal a severe blow to your project.
To understand why this is happening, let’s first look at what happens when the user adds a document to the library when the Require Check Out option is disabled: So the net result of this is that the document is uploaded and the Item Adding and Item Added events have fired, which is pretty much what you would expect.
Next, let’s look at what happens when the user adds a document when the Require Check Out option is enabled.
Later on, when you checked the document in, you would see those events fire again.
So the double-event firing isn’t a bug, it’s just a result of the automatic check-in that occurs when you first add a document to a document library.
You can think of an item event receiver like a database trigger: it has different events that fire during the course of Share Point running an operation on a list item (or document item).
Item Event Receivers derive from the SPItem Event Receiver class and have a number of methods that can be overridden to respond to various events: As you look through this list, you should notice that events have two types of endings: WARNING: One major gotcha you should know about the SPItem Event Receiver class is that while you can implement multiple list item event handlers in a single class, Share Point instantiates a new instance of that class for each individual event it needs to handle.We may never know about all of the dangers lurking out there, but today we’re going to cover at least one danger you may encounter while writing event receivers – an annoying issue with the Item Updating and Item Updated events firing twice.I should also point out that I know the difference between a metaphor and simile in case that was bothering you from the opening sentence.It appears as though they are firing twice in this situation because Share Point is updating the properties on the document and then checking it in on the same request.If you were to check the document out and edit the properties on the document, you would see the Item Updating and Item Updated events fire once.If not, kudos to you for tackling the object model with reckless abandon.