Forum Discussion
Adam Andersson
Jan 19, 2021Brass Contributor
Content Type Hub - Cannot delete content type
Hi,
Guess this has been discussed many time and I have tried all different things without success. Have also an open ticket with Microsoft whom are just sending references to public docs which is not helpful.
My issue:
Cannot delete a Content Type (CT) from the Content Type Hub via the SPO Admin Center with the error that it is still in use.
What I have done:
- I have tried to publish the CT, wait for +8h and then unpublish it and wait another 4-8h before trying to delete it.
- Have emptied the primary and secondary recycle bin for each site in the tenant using PnP
Clear-PnPRecycleBinItem -All -Force​
3. Via code trying to find the content type and having it removed. Below code is currently saying that the CT with a specific ID is not found on any site.
function FindContentTypeById {
param (
[Parameter(Mandatory=$true)]
[string]$ContentTypeId
)
## Get all sites in the tenant
$siteCollections = GetSites
foreach ($site in $siteCollections)
{
$siteUrl = $($site.Url)
Write-Host "+ Site: $siteUrl"
ConnectPnPOnline -Url $siteUrl
$lists = Get-PnPList
foreach ($list in $lists)
{
$ct = Get-PnPContentType -List $($list.Title) -Identity $ContentTypeId -ErrorAction SilentlyContinue
if($null -ne $ct) {
Write-Host -ForegroundColor Yellow " - Found CT"
Write-Host -ForegroundColor Yellow " - Found: $($ct.Name) in List: $($list.Title)"
}
}
$siteCTs = Get-PnPContentType
$x = $siteCTs | Where-Object {(($_.Id).StringValue -eq ($findCT))}
if($null -ne $x)
{
Write-Host " - Found: $($x.Name) in ($site.Url)"
}
Disconnect-PnPOnline
}
}​
I have also run code that looks for a Content Type by Name with the same result (not found).
So, any ideas what else I could do/try to have the CT deleted?
The CT Hub is in need of major improvements to better support SPO. Implementation of better logging/auditing capability (tracking down what site/list/item is restricting deletion) and better provisioning functionality are some. As of now the CT Hub is a loose canon causing lot of headaches and instead of using it I'm avoiding it.
/Adam
No RepliesBe the first to reply