Phantom Content Types and Site Columns show up in newly created site collections (SharePoint Online)

Mike Sharp 131 Reputation points

This is a really weird one. I was defining a few site columns and a simple document based content type and ran into problems when they were published to a site collection. I didn't create anything crazy, just an MMS column, a couple text columns, a choice column, a couple date columns and one person/group column. But I couldn't use them on a subscribing site, because something was fundamentally broken with inheritance on them. Eventually I gave up, and started from scratch, and this time everything worked great.

So now I wanted to delete the old site columns and content types (I used different names for the new ones), which I did on the content type hub (e.g. I also deleted the old site columns and content types from the site collection I was working on.

But if I republish any other type of update to a content type, the old content types and columns show up again.

Using PnPPowerShell get-pnpcontenttype, the old content types do not show up in the CTH, nor do the old site columns. They truly don't exist anymore as far as I can tell, yet a newly created site collection will get them when the subscription updates.

If I use that same PnPPowerShell on a site collection, the old content types do show up. I can delete them, and they'll show up again later.

How do I get rid of these things so they don't show up on future sites (or on existing sites)?

A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
6,441 questions
No comments
1 vote

Accepted answer
  1. ChelseaWu-MSFT 6,241 Reputation points

    @Mike Sharp , Thanks for the update.

    Did you delete the content type directly from the Content Type Hub before you unpublish it via Site Content Types > the published Content Type > Manage publishing for this content type > Unpublish?
    If that is the scenario, you need to recreate the old content type in the Content Type Hub with the same name and GUID, so that you can unpublish it and have the system remove it from all sites.

    Here is a sample PowerShell script to recreate the content type in CTH for your reference:

    function New-SPOContentType {  
    	$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($Url)  
    	$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $(convertto-securestring $AdminPassword -asplaintext -force))  
    	$lci = New-Object Microsoft.SharePoint.Client.ContentTypeCreationInformation  
    	$lci.Description = $Description  
    	$lci.Name = $Name  
    	$lci.ID = $ContentTypeID  
    	#paramters.Id and parameters.ParenetContentType cannot be used together.  
    	$lci.Group = $Group  
    	$ContentType = $ctx.Web.ContentTypes.Add($lci)  
    	try {  
    		Write-Host "Content Type " $Name " has been added to $AdminUrl" -foregroundcolor green  
    	catch [Net.WebException]{  
    		Write-Host $_.Exception.ToString()  
    # Paths to SDK  
    Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"  
    Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"  
    # Parameters  
    $Username = "<>"  
    $AdminPassword = "<password>"  
    $AdminUrl = "https://<tenant>"  
    $Description = "<Description>"  
    $Name = "<Original Name>"  
    $ParentContentTypeID = "0x0120D520"  
    $ContentTypeID = "0x0120D52000EF84D53385206F439993CB193716595A" #Same in all sites  
    $Group = "Custom Content Types"  
    New-SPOContentType -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl -Description $Description -Name $Name -Group $Group -ParentContentTypeID $ParentContentTypeID  

    References: Contenttype hub publishing old (deleted) content types. / SharePoint Online content types in Powershell: Add.

1 additional answer

Sort by: Most helpful
  1. ChelseaWu-MSFT 6,241 Reputation points

    Content type hub syndication is achieved via timer jobs, which are not manageable in SharePoint Online.
    The timer job runs every 4 hours in SharePoint Online, and the more sites or content types you have, the longer it will take for the timer jobs to finish processing changes.

    It seems that you are experiencing delay after you delete the old content types from the Content Type Hub.
    I would suggest you wait for one day and then check the result via a new site again.

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    **Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. **