2

I have a custom parent content-type on which I apply 6 event-handlers. I then have 24 content-types based off of the parent content-type - thus inheriting the 6 event-handlers.
- All defined in XML

I then have a list-instance in which I bind the 24 content-types.

When I deploy the list is correctly created from the list-instance and the content types are correctly bound to the list.

When I then uploaded some documents I noticed some weird behavior with the event-handlers.
I decided to check it out using powershell and found that the event-handlers bound to the custom parent content-type was bound 24 times to the list.

So I have 24 * 6 event-handlers on my list. I have no clue how this has happened as I bind the event-handlers to the custom parent content-type.

Is this a bug or is this expected behavior and I missed a detail?

1

I found some documentation referencing the above behavior and explains it.

When attaching content-types to lists/libraries, the content-types event-handlers are automatically added to the list's event-handler collection. This it to support some basic list/library functionality which has been around since WSS 3.0 already.

Even though all the event-handlers are added to the list/library, it is only the ItemAdding event which gets triggered every time a document is added. This is because any content-type could potentially be the default content-type of the list/library, and SharePoint executes them all just-in-case, but only the ItemAdding event.

For more information, download this document from Microsoft explaining the implementation of event-handlers and possible troubleshooting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy