Next, let’s look at what happens when the user adds a document when the Require Check Out option is enabled.The first time the Item Updating and Item Updated events fire it is in response to the document properties changing.Developing a Sharepoint application would have all the fun of a video game, if only you had infinite lives.
For example, if you define an instance level variable in the class to store data in the Item Updating event, then try to access that data in the Item Updated event, you will find that the data is not there when you go to check it in the Item Updated event.
This is because you have two classes – one that is handling the Item Updating event and in which the instance level variable is set, and one that is handling the Item Updated event in which the instance level variable is not set.
With that in mind, Share Point 2010 is like a sea of icebergs – there is a lot going on under the surface that you may not notice until it’s too late.
Unfortunately, that makes your project like the Titanic.
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.
What this means is that you cannot store data in instance-level variables and share that data between event handlers.Damon gives just one example of a poisoned dagger in the game of Sharepoint Development: The Item Event Receiver.I’m usually disappointed when writers employ oft-overused metaphors to describe a situation.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.I am nothing if not a masterful linguist after a beer or two or more.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.