开发者

Content Type can't be deleted

I have a content type that won't go away. I've tried messing with the feature that installed it (reinstalling, deactivating, retracting, etc.), to no avail. Finally, here is an attempt in PowerShell that illustrates the problem succinctly:

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.Dele开发者_Go百科te <<<< ()
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Anyone have any idea what I can do about this? I'm developing a solution with content types in it, and I can't make changes because it fails to retract properly and the subsequent deployment fails.


You need to check:

  • This content type is not being references by a list or document library
  • This content type is not being references by a list or document library that's in End User Recycle bin
  • This content type is not being references by a list or document library that's in Site Collection Recycle bin
  • If content type was deployed via feature you need to retract it

Update: The key to this is removing items from both recycle bins as clearing items from the end user recycle bin does not remove them entirely.

You still need to go to Site Settings > Recycle Bin (Under site collection administration) and then remove all items from the "Deleted from end user Recycle Bin" view.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜