无法删除SharePoint 2010 ContentType"正在使用的竞争类型".

Sha*_*yne 37 content-type sharepoint-2010

我已尝试过网上的所有建议,但无济于事.

我根据这些说明编写了一个控制台应用程序:http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontenttypecollection.delete.aspx

"Usages.Count"是= 0.但是,当它试图删除内容类型时,我得到一个异常:

"内容类型正在使用中."

这是一个全新的(开发)安装.我在SP Designer中创建了一个测试站点,创建了一个内容类型,然后创建了一个列表.然后,我删除了列表,将其从回收站中删除,并尝试删除内容类型......呃.

Eri*_*sen 72

在我发现你的评论之前,我对此问题感到沮丧.很好的建议.

  1. 从站点回收站中删除.
  2. 从网站集>网站设置>网站集管理>回收站中删除.
  3. 从最终用户回收站项目中删除.
  4. 从"从最终用户回收站中删除"中删除.

这是很多回收!完成后,我就可以删除内容类型.

  • 谢谢你为我节省了6个小时的挫折感. (6认同)
  • 无法让它工作,但现在我知道网站收集回收站和最终用户回收站在网站集级别! (3认同)

小智 7

除了回收箱之外,文档库的"权限和管理"下还有名为"管理文件没有签入版本"的页面 - 其中的文件也可以防止删除内容类型.


Mah*_*hat 6

这篇powershell脚本形式这篇文章也对我有用

$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()
Run Code Online (Sandbox Code Playgroud)