TwitterLinkedInBlog

Thursday, May 29, 2014

PowerShell - Custom List - Delete All Versions

$web = Get-SPWeb "http://localhost"
$list = $web.Lists["MyList"]
foreach ($item in $list.Items)
{
  $item.Versions.DeleteAll()
}
$list.EnableVersioning=$False
$list.update()
$web.Dispose();

Update: This seems to have issues, so need to follow up with better solution.

No comments: