Example: Prune the versions of all items in a list to a maximum of 20
$w = get-spweb http://myweb; $l = $w.Lists["My List"]; $items = $l.Items; foreach($item in $i){ if($item.Versions.Count -gt 20){ $vtr = $item.Versions.Count; while($vtr -gt 20){ $vtr--;$item.Versions[$vtr].Delete() }}}
No comments:
Post a Comment