Sorry, something went wrong the content type is in use

Advertisement

When we tried to delete a content type, we are getting an error “Sorry, Something went wrong the content type is in use”.
So we prepared a PowerShell script to get the list of places we used the content type in the site collection level and its sites/sub sites

Add-PSSnapin Microsoft.sharepoint.powershell
$site = Get-SPSite("http://dotnetsharepoint.com/sites/sharepoint2013");#enter your site collection URL
foreach ($web in $site.AllWebs) {
    $contypes = $web.ContentTypes["your content type name"]#enter your content type name
    foreach ($ctype in $contypes) {
        $usages = [Microsoft.Sharepoint.SPContentTypeUsage]::GetUsages(
$ctype)
        foreach ($usage in $usages) {
        Write-Host $usage.Url
        }
    }
}

Finally in the Output, we can able to identify the list if place we used the content type, so if you don’t want to use this content type anywhere, delete it first in the usage url location, then finally delete at site collection level.


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM
Advertisements
SHARE

Lakshmi Tulasi Jasti

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment