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
在我发现你的评论之前,我对此问题感到沮丧.很好的建议.
这是很多回收!完成后,我就可以删除内容类型.
这篇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)
归档时间: |
|
查看次数: |
45958 次 |
最近记录: |