2

I have a SharePoint 2013 site with Multi Tenancy configured. I have a Managed Metadata Service also configured in Partitioned Mode since it is a multi tenant environment. I have a Visual Studio project with Site Columns, Content Types, Lists and Event Receivers. Some of the Site Columns are of Taxonomy type. Also, all the Site Columns and Content Types are declarative (CAML based). The lists are created through code. There is a reason for this. For every Tenant, we have a site collection for Content Type Hub, Root Site and Document Center Site along with the Tenant Admin site. Once we deploy the Site Columns and Content Types in our Content Type Hub and publish the Content Types, these Content Types don't reflect in the other site collections till the Content Type Subscriber Timer Job runs (we have configured it to run for every 1 min, though) and our lists need to be created in the Root Site and they need these Site Columns / Content Types. So, if we create the lists declaratively using CAML, then we were facing issues, since the Columns and Content Types were not getting populated. We could get around this only by creating the lists through code.

In the above scenario, we have some Parent Content Types and Child Content Types and lists in my root site are created from the Child Content Types. For 3 to 4 lists, we have written a common event receiver for Item Added and Item Updated events. Hence we tried to attach this event receiver on the Child Content Types (attached to different lists). But these event receivers are not firing. I read in some blogs that, event receivers have to be attached to the Parent Content Type and it will work. This also didn't work. Since our content types are published and subscribed, we tried to attach the event receivers before publishing, but they don't get subscribed though the content types did. Hence I tried to attach the event receivers directly to the content types, after they get subscribed in the root site, but still it didn't work. We tried both declarative and code based approaches for attaching the event receivers to the content type, but with no luck at all. Can anyone please help?

1 Answer 1

0

See this 4th Post it would appear adding event receivers or any customisation to the Content Type in the Subscribed Site Collection will stop it being published from the Content Type Hub with new changes. Although creating the List with the event receivers already attached will get around one issue it creates another.

https://social.technet.microsoft.com/Forums/en-US/8bd4eed4-302d-4c73-a8fa-649078cb725a/content-type-hub?forum=sharepointgeneral

Reading more broadly on the internet other solutions using apps (with event receivers) generally advise to not use the Content Type Hub.

You will see posts on Technet and MSDN that normally an import conflict is caused by the internal name being the same on a Site Column or a Content Type. What they neglect to mention is any change to the Published Content Type in the Subscribed Site collection will stop the Content Type publishing changes from the Content Type Hub. Our experience is adding workflows or event receivers say for example when an app installs into the Subscribed Site Collection then stops the subscribe.

Other posts on Technet and MSDN will suggest removing the conflicting column or Content Type. Doing this (also remove the App) then republishing them once the App is reinstalled with Workflows or Event Receivers on the Content Type Columns will then break or stop the Content Type Hub from publishing changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.