Umbraco

ссылка

Реклама

Unable to delete SharePoint 2010 ContentType “Contenty type in use.”

update ContentTypes
set isfromfeature = 0
where (sys.fn_varbintohexstr(ContentTypeId) LIKE ‘0x010200C4C41193C5C3466190F25E0881CF4B2C’)

$siteURL = «https://portalies»

$web = get-spweb https://portalies
$cts = $web.ContentTypes | Where-Object {$_.FeatureId -eq ‘367b94a9-4a15-42ba-b4a2-32420363e018’}

foreach ($ct in $cts ) {
if ($ct) {
$ctusage = [Microsoft.SharePoint.SPContentTypeUsage]::GetUsages($ct)
foreach ($ctuse in $ctusage) {
write-host $ctuse.Url
#$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.»
}
break;
}
$web.Dispose()