A general software development principle is to suspend or temporarily disable events from firing that you may trigger unintentionally from your code.
It is particularly difficult to do this yourself in an event receiver in Share Point because you typically don’t have any context to work with.
In our scenario, we did not want to take any additional action on restored items, so we did an immediate return when we determined it was an item from the Recycle Bin.
- which online dating site is best
- Free porn private chat 1 on1
- cj thomason dating
- Fuking girls chating facebook
As you design an Application solution in Share Point that involves the use of Share Point event receivers, you have to consider that event receivers can fire in situations that you may not anticipate.
Therefore, you need to code defensively as the object you are expecting to be available in the Event Receiver may be null. So, in our situation, we check for this condition and return immediately when it is true.
It turns out there is actually a very simple way to accomplish this, but it’s not clearly documented in the places you would expect it.
The MSDN documentation on the Item Updated and Item Updating event make no mention of a method called Disable Event Firing.
This walkthrough is based on the first one where I have a custom list with planets of our solar system.
Users can change data like the number of moons or the distance to the earth, but they are not able to change the name of the planet.It turns out that by calling this method at the beginning of your event receiver you can prevent yourself from getting into an infinite loop.You do want to make sure to call Enable Event Firing when you are done however.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.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.Developing a Sharepoint application would have all the fun of a video game, if only you had infinite lives.