Sharepoint itemupdating event

06 May

The library was configured with multiple Content Types, but the issue occurred only on some of them.

It appeared that for those Content Types, the Managed Metadata field was Optional, not Required.

I had already covered all the basic things such as: I even went as far as completely emptying the body of the handler to see that in fact the event was firing twice.

As with any problem, I always try to resolve it through the process of elimination by first isolating the core issue into a test project and therefore out of the primary project I’m experiencing it in because sometimes you can’t see the forest because of the trees. After creating the simple project, the problem was still there. The event wasn’t firing twice for the same list, it was firing for ALL Lists. I took another look at my event receiver I had added via Visual Studio to the project. Yes, I had left the file for the Event Receiver there, and therefore when the feature was activated for the project, the receiver got associated to ALL lists on the site.

Every time an item was added to the custom list, the event was firing twice.

I was associating the event receiver to the custom list through Feature Activated on a feature receiver for my Event Receivers project.

I tried reproducing that configuration in a new document library but there everything kept working, so the issue had to be with the existing library.

Further analysis, comparison and reflection showed that the problematic library was missing some Taxonomy-related Event Receivers.

sharepoint itemupdating event-58sharepoint itemupdating event-76sharepoint itemupdating event-2

The weirdest thing was that there were no errors to be found in the ULS logs or the Event Log.We also had a Power Shell script which was used for bulk updating of documents.This script was scheduled to run at regular intervals using Windows Task Scheduler.Even a simple app to enumerate the event receivers associated to the list only showed the one instance. Well, I had moved on to other things again, when all of a sudden, I noticed that new tasks were being created in the task list for some documents that I was uploading to a different document library. That’s pretty much the symptom for a receiver associated to a list template, but this was NOT a list template! It wasn’t going to show up in the Event Receivers collection for that list instance, because it was associated to the list type.When I added it to the list instance, it just caused the event to fire twice on THAT list.