powershell 这将查找并回收SharePoint列表项。也是分组项目的示例。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 这将查找并回收SharePoint列表项。也是分组项目的示例。相关的知识,希望对你有一定的参考价值。

$web = Get-SPWeb -Identity https://xxxx 
$list = $web.Lists["Archive"]

$AllDuplicates = $list.Items.GetDataTable() | Group-Object title | where {$_.count -gt 1}

$max = $AllDuplicates.Count

#Retrieve all event receivers associated with the list
$list.EventReceivers | Select Id, Type, Assembly, Class
$confirmation = Read-Host "press any key to continue......."

foreach($duplicate in $AllDuplicates) 
{ 
$items = $duplicate.group | Select-Object -Skip 1 | % {$list.GetItemById($_.ID)}
foreach($item in $items)
{
	$item["Title"]
	$item["Title"] | out-file "f:\temp\dupsdeleted.txt" -append
	$item.Recycle()
}
if($max -gt 0){
	Write-Progress -PercentComplete ($count / $max * 100) -Activity "$count duplicates removed" -Status "In Progress"
}

$count++ 
}

$list.EventReceivers | Select Id, Type, Assembly, Class

以上是关于powershell 这将查找并回收SharePoint列表项。也是分组项目的示例。的主要内容,如果未能解决你的问题,请参考以下文章