Unable to delete SharePoint 2010 ContentType "Contenty type in use."
Solution 1
I was frustrated by this issue until I found your comment. Excellent advice.
- Delete from site recycle bin.
- Delete from Site Collection > Site Settings > Site Collection Administration > Recycle Bin.
- Delete from End User Recycle Bin Items.
- Delete from "Deleted From End User Recycle Bin."
That's a lot of recycling! Once complete, I was able to delete the content type.
Solution 2
In addition to the recycling bins there's also the page called "Manage files which have no checked in version" under "Permissions and Management" on document libraries - the files in there can also prevent deletion of a content type.
Solution 3
this powershell script form this post also worked for me
$siteURL = "The Site url"
$contentType = "Content type Name"
$web = Get-SPWeb $siteURL
$ct = $web.ContentTypes[$contentType]
if ($ct) {
$ctusage = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)
foreach ($ctuse in $ctusage) {
$list = $web.GetList($ctuse.Url)
$contentTypeCollection = $list.ContentTypes;
$contentTypeCollection.Delete($contentTypeCollection[$contentType].Id);
Write-host "Deleted $contentType content type from $ctuse.Url"
}
$ct.Delete()
Write-host "Deleted $contentType from site."
} else { Write-host "Nothing to delete." }
$web.Dispose()
Shayne
Updated on November 26, 2020Comments
-
Shayne over 3 years
I have tried all the recommendations on the web, to no avail.
I wrote a console application per these instructions: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontenttypecollection.delete.aspx
The "Usages.Count" is = 0. Yet, when it tries to delete the Content Type I get an Exception:
"The content type is in use."
This is a brand new (development) install. I created a test site in SP Designer, created a Content Type,then a list. Then, I removed the list, removed it from Recycle Bin and tried to remove the content type...... Ugh.
-
skaz almost 13 yearsThanks for saving me 6 more hours of frustration.
-
barrypicker almost 10 yearsCouldn't get it to work, but now I know about the site collect recycle bin and the end user recycle bin at the site collection level!
-
Alan M over 9 yearsThis worked for me when I had a site content type that would not delete even when I saw it was emptied out of all the recycle bins at every level.
-
Vivek Ayer almost 8 yearsThis worked for me after deleting all the recycle bins and I still could not delete it from the UI
-
GBU over 7 yearsNice one, I had forgotten the CT in use on some subsite and the code pinpointed it to me. Just adding a little bit: The message inside the for-each should enclose $ctuse.Url in $() to show the URL where the CT is in use:
$($ctuse.Url)
-
Shayne over 7 yearsJust so everyone knows, the (C#) code above is just a "copy/paste" of the one I mentioned (and included the URL for) in the OP. :)
-
Chiramisu over 6 yearsYou can find additional causes in My Answer on the SharePoint SE. ;)