Sharepoint 2010 Content Type Query Usage Locations

When attempting to delete a content type you may recieve the error: "The content type is in use."

The following steps can be taken to determine where (the url) the content type continues to maintain a reference in.

From the url you can visit the item and delete the item (removing the dependency on the content type).

NOTE: If you have items in the recycle bin, GetUsages() may report a false "0" count.

PS C:\Users\spsetup> $ct1 = $web.ContentTypes["HowToPage"]
PS C:\Users\spsetup> $ct1.ToString()
PS C:\Users\spsetup> $web.ContentTypes.Delete($ct1.Id)
Exception calling "Delete" with "1" argument(s): "The content type is in use."
At line:1 char:25
+ $web.ContentTypes.Delete <<<< ($ct1.Id)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

PS C:\Users\spsetup> $usages = [Microsoft.Sharepoint.SPContentTypeUsage]::GetUsages($ct1)
PS C:\Users\spsetup> $usages.ToString()
PS C:\Users\spsetup> $usages.Count
PS C:\Users\spsetup> write $usages
Id                         Url                                      IsUrlToList
--                         ---                                      -----------
0x010109009FEDEAD31D814... /Documents                                      True


Popular posts from this blog

Change Password in Windows Server 2012

Microsoft Flow - Renaming Files in SharePoint Online using Flow

SharePoint Set Locale Region on All Web Applications and Site Collections