SharePoint 2007 - Document Library - Deleting All Versions in Bulk
I manage a MOSS 2007 enterprise server that has a site collection with about 5k documents in the document library. The docs are mainly PDFs and there are anywhere from 3 to 10 versions of the each, which we do not need & are just taking up valuable database space. The person who set up the site left versioning on w/ no limits, which I have since turned off. I wanted to know if there's an easier way to delete those old versions w/o manually open each doc in the site content & structure tool and clicking the deleting all versions link and then emptying the recycle bin to release the space in db. I saw there was a tool for MOSS 2003, but can't find anything similar for MOSS 2007.
June 19th, 2009 4:10pm

Hi, If you set the number of versions that a document library should have, then the next time someone goes to upload a document, that document will delete all previous versions up to the number you specified.Example: If you a document in a library has 50 versions, then you modify the settings to 3 major versions only. If you look at the document's version history you will still see all 50 versions. If you upload a new version of that same document then 47 versions dissapear and you have the 3 versions that you want.Here is an article that explains this.http://www.sharepointblogs.com/agoodwin/archive/2008/04/01/how-to-delete-historical-document-versions-in-wss-3-moss-not-entirely-simple.aspxHopefully that helps.Sincerely, Karl
Free Windows Admin Tool Kit Click here and download it now
June 19th, 2009 5:24pm

You can use either Object model code or PowerShell to delete versions, $SPweb = Get-SPWeb "http://SharePointSite.com" $versionsToKeep =5; $SPlist = $SPweb.Lists["Tasks"] foreach ($SPitem in $SPlist.Items) { $currentVersionsCount= $SPItem.Versions.count if($currentVersionsCount -gt $versionstoKeep) { for($i=$currentVersionsCount-1; $i -gt $versionstoKeep; $i--) { $SPItem.versions[$i].delete() } } } More info: http://salaudeen.blogspot.co.uk/2011/01/limitcleanup-versioning-in-sharepoint.html
April 10th, 2012 3:35am

This solution has the the potential to destabilize your system for a time, as I have experienced and reproted. Note that the next *user* to update an item takes the hit. http://social.technet.microsoft.com/Forums/en-US/sharepointadmin/thread/18aa7921-eb72-4813-bf36-513fde307403 Salaudeen Rajack's code solution below is recommended for larger numbers of versions. David McKenzie
Free Windows Admin Tool Kit Click here and download it now
October 9th, 2012 10:30am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics