Forum Discussion
Changing number of versions to keep
So by default, I believe a new SPO site sets the version history number to 500. This number is even higher on some of our sites. This is causing our SharePoint storage to be heavily inflated than what it actually is. For example, we have some sites that have over 600 versions of a 10MB PowerPoint, which means it is taking up 6 GB for that file alone.
I would like to cap the number of versions that a document library can have. Questions I have are:
- Can I enable this for all document libraries at the tenant level? I've found some scripts but that needs to be applied at the document library level
- If I change the limit from 500 to 100, would that automatically start to the delete the oldest versions until there are 100 versions left and keep the newest 100?
- Is there a best practice on the number of versions to keep? Even 100, what I am planning on setting, seems to be a bit much.
Thanks.
CaptainReboot As per the documentation Set-SPOTenant, you can set the maximum major version limit at tenant level.
But, you might get an error while using EnableAutoExpirationVersionTrim parameter in commands some times as it is still an experimental feature and might not be available for your SharePoint tenant yet.
Microsoft will be releasing some new features related to this parameter and version history in November 2023 and then GA will be around March 2024.
Till then you might need to do version limit changes for individual libraries using PowerShell if above parameter does not work for your tenant.
Yes, newest 100 versions will be kept and older versions will be deleted. You can change the number of versions to keep as per your company/project requirements. 50-100 versions might be enough for some customers and some customers might want to keep more than those.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Scott TriffettCopper Contributor
Thanks for this information.
If setting this, will static retention still take precedent.
I'm trying to clean up 100's of sites, which we have all libraries set to 101 versions.
We have 1000's of files with over 1000's of versions due to the 2 - 7-year retention (depending on site) takes precedence over the version limit.
Currently have to take each site of retention, and run a script, but then MS throttling gets involved, meaning several passes are needed...
- KotiReddyBrass Contributor
CaptainReboot From my experience
1. You can not do on tenant level . you have to use script to do.
2. minimum can be 100. If document not modified all versions will be present ( by reverting settings you can see versions). If doucment modified it will retain only last 100 versions.
3. Everyone issue in sharepoint online is versioning and data storage. As every version counts full size of file towards quota. It is all depends on your requirements. 100 should be OK for any one. No one corrupt file more than 100 versions.