Afternoon all,

I have an old document library that par back in it's past had Versioning turned on. This was deactivated whilst a lot of auditing work was done and turned on for a project go-live.

When we did this, it was seen that the old versions from yesteryear were still present.

Is there anyway to clear these old versions out "en masse?"

Thanks in advance


You can view the item history for a file and delete all previous major and minor versions.

To do it in bulk, I found this post describing how to do it with PowerShell:

# get site
$site = new-object Microsoft.SharePoint.SPSite("http://mossdev:8000")
# loop through webs
foreach ($web in $site.AllWebs)
  # loop through all lists in web
  foreach ($list in $web.Lists)
    # examine if BaseType of list is NOT a Document Library
    if ($list.BaseType -ne "DocumentLibrary") 
      # forget the rest and return to top
    # loop through each item
    foreach ($item in $list.Items)
      # work with the file object as we're in a document library
      $file = $item.File
      # delete all versions
  • Hi Eric, Cheers for your feedback. I've updated the post with a little more info. Is there any way to do this in bulk as I've got quite a few items that this will need to be done on. – Steven D Andrews Jul 2 '13 at 15:26
  • Edited wit a bulk option – Eric Alexander Jul 2 '13 at 15:35
  • Looking at the code, do you think the $site will accept a sub-site address rather than a root site? – Steven D Andrews Jul 2 '13 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.