即使在禁用和卸载SharePoint功能以及卸载和删除SharePoint解决方案之后,.webpart文件仍会列在“Web部件库”中。
我按以下顺序发出命令:
Disable-SPFeature
Uninstall-SPFeature
Uninstall-SPSolution
Remove-SPSolution
我仍然可以看到.webpart文件正在徘徊。想象一下,我知道Web部件文件名(例如abc.webpart),如何使用SharePoint PowerShell清理它们(完全删除)。
答案 0 :(得分:0)
这个powershell应该让你开始(它不是生产就绪,但会完成这项工作)
$spQuery = New-Object Microsoft.SharePoint.SPQuery
$camlQuery = '<Where><Eq><FieldRef Name="FileLeafRef" /><Value Type="Text">abc.webpart</Value></Eq> </Where>'
$spQuery.Query = $camlQuery
$site = Get-SPSite -Identity "http://site-collection-url"
$webpartgallery = $site.GetCatalog( [Microsoft.SharePoint.SPListTemplateType]::WebPartCatalog)
$webparts = $webpartgallery.GetItems($spQuery)
$webparts[0].Recycle()