1

I have defined a content type in content type hub. I would like to use this content type on a site (other than the hub) but also to extend it with an additional (lookup) column. Is it possible to do so and to preserve the synchronization of the content type with the content type hub?

The reason why I need this in the first place is because I cannot create a lookup column within the content type hub and make it work in another site collection. I've read somewhere that if you create a list (the one the lookup is targeting) inside the content type hub site, make a template from it and then recreate that same list on another site, that the lookup would work. But it doesn't - I expected this, because the GUIDs don't match.

So is there a way to solve this?

1 Answer 1

1

Irrelevant of the Content Type hub, working with look-up columns can be tricky. You either create them declaratively (at the time of Content Type deployment) - which also assumes the list you are targeting is already there (or self-referencing -the same way the Tasks or Issues list work) or use code, say during a FeatureActivated handler where you could create the lookup programatically and attach it to the list - could be targetting content type at the SPWeb level.

So, a potential solution for you would be (assuming you already have properly publish Content Types from the CT-Hub) to either manually add the lookup on the list, or still manually create a new Content Type at the Web Level, which inherits from the one coming from SPSite level, and published by the CT-Hub and add the lookup at the SPWeb level, as this way you could target the proper list.

Or programatically, create a new SPContentType by using the construction enabling you to pass in the SPContentTypeId of the Parent and add it directly into the SPWeb.ContentTypes collection. Once SPWeb Updated you could create a new Lookup column and link it to your new Content Type.

1
  • @Marius, thanks for replying. I have thought of going for the approach in which I manually create an inheriting content type at the web level and extending it with the lookup column. This, however, brakes the synchronization with the CT hub, i.e. if I edit the content type in the hub after the web level content type is created, it (the inheriting content type) does not get updated. It looks like the inheritance breaks the dependency with content type in the content type hub.
    – Boris
    Commented Jul 13, 2012 at 11:44

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.