One of the great new features in SharePoint 2010 is the Content Type Syndication Hub, where we can finally achieve global content types (without having to write additional code). This ability is achieved by creating a site collection that we designate as the hub that pushes content types to web applications that subscribe to it.
Along with the content types and their related site columns, event receivers also come over during this synchronization process. Attaching event receivers directly to a content type is a good way to ensure your code runs wherever the content type is used.
I have updated this post to provide detailed instructions on how to reproduce an issue where event receivers in the subscribing site’s content types appear to be removed when a parent content type that they are based off of, which is in the syndication hub, gets updated with additional event receivers.
Here are the steps to reproduce the issue:
- Create a content type in the syndication hub, with one or more event receivers attached, and publish it
- Create a child content type in a subscribing site based on the content type created in the hub, and add one or more event receivers directly to it (at this point it should have the event receivers from the global content type as well as the new ones added in this step)
- Update the parent content type in the hub by adding one or more additional event receivers
- Republish the content type in the hub
- Once the sync takes place, the child content type no longer has the event receivers that were attached to it, and instead only reflects the event receivers in its parent (I have also found through other configurations where the parent event receivers never make it to the child content type)
The one quick fix to this solution is to reattach any event receivers on your child content types that were removed. However, I am still researching this issue for more information. I will update this post once I have more details.