Articles about European Sharepoint Hosting Service
SharePoint 2013 Hosting – HostForLIFE.eu :: How to Cleanup SharePoint Version History?
In this article, I will explain you about how to cleanup sharepoint version history. In a SharePoint document library, we can see the document versions across the site collections. We have a large amount of document versions, some of which will not be required. The code snippet given below will execute and clean up all the document version’s history across the site collections.
Steps
- Open your SharePoint Management Shell.
- Copy the code given below and paste it.
- Run the code given below.
- Open your SharePoint site.
- Check that the execution completed successfully or not.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
$SPsite = new-object Microsoft.SharePoint.SPSite("https://gowtham.sharepoint.com/") $website=https://gowtham.sharepoint.com/tutorials/tutorials $web = $SPsite.OpenWeb($website) foreach ($list in $web.Lists) { if ($list.BaseType -ne "DocumentLibrary") { continue } foreach ($item in $list.Items) { $file = $item.File # delete all versions in the document library $file.Versions.DeleteAll() } } $web.Dispose(); $site.Dispose(); If you want to delete this one in particular library use this $SPsite = new-object Microsoft.SharePoint.SPSite("https://gowtham.sharepoint.com/") $website=https://gowtham.sharepoint.com/tutorials/tutorials $web = $SPsite.OpenWeb($website) $list="Docuemnts" $list = $web.Lists[$list] if ($list.BaseType -eq "DocumentLibrary") { foreach ($item in $list.Items) { $file = $item.File $file.Versions.DeleteAll() } } $web.Dispose(); $site.Dispose(); |
SharePoint 2013 Hosting Recommendation
HostForLIFE.eu’s SharePoint 2013 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2013 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2013 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2013 plans as well as dedicated SharePoint 2013 Foundation options.
Print article | This entry was posted by Peter on February 8, 2017 at 5:23 am, and is filed under European SharePoint 2013 Hosting. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |