Itemupdating which wasn t handled

Rated 3.86/5 based on 804 customer reviews

You just have to check to see if the vti_sourcecontrolcheckedoutby property on the item was cleared: This code is using the Before Properties and After Properties on the properties parameter to see what the value of the vti_sourcecontrolcheckedoutby property on the item was before the update occurred, and what it will be after the update has completed.

The vti_sourcecontrolcheckedoutby property identifies who the item is currently checked-out to.

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.

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.

These methods are just like the Item Updating and Item Updated methods in the SPItem Event Receiver class, but they have an additional Boolean parameter named is Check In that indicates whether or not the event is being raised as result of a check-in operation.

The second time they fire it is in response to the document being checked in.

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.

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.

Leave a Reply