1

I have a small Visual Studio 2010 project with one farm level feature that I deploy to a site collection which is configured as my content type hub. The FeatureActivated event adds a site column and then adds a custom content type made up of the newly added site column and a few other existing site columns.

There are several other site collections in this web application and they are all eventually getting the content type published to them from the hub. That part works OK.

What is the best method of UN-publishing a content type from a site collection that was a target of the hub? I cannot find any info on this.

When I deactivate the feature in the hub site collection, it removes things properly but the other site collections that received these items via syndication with the hub continue to have the site column and content type (despite removal from the hub).

Here is a snippet of my feature

public class TeleWorkAgreementEventReceiver : SPFeatureReceiver
 {
    private const string ContentTypeName = "Tele-Work Agreement";
    public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
    {
        //Get references to the site and web, ensuring correct disposal 
        using (SPSite site = (SPSite)properties.Feature.Parent)
        {
            using (SPWeb web = site.RootWeb)
            {
                var ct = web.ContentTypes[ContentTypeName];
                if (ct != null)
                {
                    ct.Delete();
                    DeleteField(web, "ApprovingOffical");
                }
            }
        }
    }

In short, if content type publishing pushes things from the hub to the "spokes", what is the best way to remove things later. My thought is that if I add XXXX to the hub and XXXX gets published to other site collections, then deleting XXXX from the hub ought to withdraw XXXX from the other site collections (but I'm pretty sure things don't work that way).

2 Answers 2

1

Deleting content types from the hub orphans them in the spokes.

The technique I use is to delete the content types from the spokes first (you'll have to set ReadOnly = false before deleting) then un-publish the content type in the hub and then delete the content type from the hub.

2
  • Thanks. Do you delete the content type from the "spoke(s)" manually with the browser, with a Powershell script, or some other way? I was kind of hoping for a re-runnable farm-level feature that upon deactivation did NOT leave orphaned content.
    – John Adams
    Jul 31, 2012 at 22:14
  • is there anything you can do about orphaned content types on spokes? like for instance if the content type hub gets deleted?
    – Nacht
    Mar 6, 2014 at 4:01
0

Try to access the direct link like changing the value of ctype= with the right value of your content type.

server:port/yoursite/_layouts/ManageContentType.aspx?ctype=0x010082D2F7E6BD173D4DA0CF8C68A9EEA477

Check in advanced settings if the content type s marked as read only and change it back to non read only.

Then you can delete it.

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.