Question

I created a content type to play around with. I created a publishing page based on this content type, but after deleting the page (and clearing the recycling bin) SharePoint won't let me delete it.

The content type is in use.

After some investigation, I ran the following PowerShell code which would tell me where the content type is being used.

$site = Get-SPSite("http://mySite");
foreach ($web in $site.AllWebs) {
   $ctype = $web.ContentTypes["Test-publishing-page-parent"]
   $usages = [Microsoft.Sharepoint.SPContentTypeUsage]::GetUsages($ctype)
   foreach ($usage in $usages) {
      Write-Host $usage.Url
   }
}

The output was /Pages

There are no more pages that exist in the Pages collection (or the recylcing bin) that reference the content type.

enter image description here

However, I did notice that the "New Document" selection drop down contains references to this content type (and others!). In fact, it seems that I cannot delete any custom content types that are referenced in this selection drop down, even though they are not used anywhere else. Any ideas? Is this a possible bug in SharePoint 2013?

enter image description here

Note: Yes, I've already cleared the recycling bin several times, at the site level and the site collection level.

SharePoint 2013 on-premise.

Was it helpful?

Solution

The content type was added to the available content types for your Pages Library. Go to Pages > Library ribbon > Library settings > Content types section. Click on the content type name there and then delete.

That will remove it from the Pages library. Then you can go into Site Settings > Content Types and delete it there.

OTHER TIPS

I was able to find the problem and the solution.

It all started when I wanted to create a site template from a subsite. When attempting to use the template, SharePoint threw an error saying that there was a duplicate content type. It was not possible simply to delete the duplicate content type because another error was reported, something like "is still in use".

Faced with a lot of research, delete and restore my lists and some scripts later, I decided to delete all items from the "Tasks" list, which in my case was the list where the content type was associated. After that, I was able to remove it from the list and then permanently delete it from the site.

Well, this was done in a QA environment. I suggest making a back up plan before deleting items and lists.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top