Content type cannot be deleted.

I have a type of content that will not go away. I tried messing around with the function that installed it (reinstalling, deactivating, retracting, etc.), to no avail. Finally, here is a PowerShell attempt that eloquently illustrates the problem:

PS C:\Users\Administrator> $web = get-spweb http://cbaoth/sites/dev0
$ct = $web.ContentTypes["Timed Activity"]
$u = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)

if ($u.Count > 0) {
  foreach ($usage in $u) {
    Write-Output ("The content type is used here: {0}",$usage)
  }
} else {
  $ct.Delete()
  $web.Update()
}
Exception calling "Delete" with "0" argument(s): "The content type "Timed Activity" is part of an application feature."
At line:10 char:13
+   $ct.Delete <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Does anyone know what I can do about it? I am developing a solution with the types of content it contains, and I cannot make changes because it cannot backtrack properly and subsequent deployment is not performed.

+3
source share
1 answer

You need to check:

  • This type of content is not a list or document link.
  • ,
  • , Recycle bin
  • ,

. , .

" " > "" ( " " ), " ".

+2

Source: https://habr.com/ru/post/1791336/


All Articles