Forum Discussion
Version history and Retention Policies - Why do I have so many versions?
N51768 issue is that your retention policy is based on time and versioning is based on how many times you save a document. In office web the documents are saved every 25 seconds so if you have retention based on time it can be a larger file count than versioning limit.
We are continuously adding space to SP Online site, because my SharePoint online is constantly running out of space, we have huge libraries with 1000 GB and 10000 Versions.
My Question:
when retention policy in place, can we delete older versions and limit the versions to 50 using PowerShell script?
If not, what would be the best way to handle my issue?
we have retention policy in place for 7 Years.
looking for best solution for high SharePoint storage Issue.
- TimLBFeb 12, 2024Iron Contributor
For us - the retention policy affects the version history as well. So, limiting the number of versions on the library and attempting to delete specific older versions of a document are not possible with the global retention policies in place. So, the only way to reduce the size would be to delete the document - all the versions would go along with it.
I hit post early and had to edit it.
- MontegoservicesFeb 12, 2024Copper Contributor
TimLB Undo the retention policy by removing the policy (could take a day or two). Update the versioning limitation; you would have to do this on every library. This will delete the versions BUT you would have to go into each document open it and save it again for the new version limits to take effect (time consuming). This is not achievable by Power Automate so the only way would be to get users involved and have them open and close each document. There is no easy way around this but I am sure Microsoft is working on something. The time it takes to label a document is time-consuming in that automated process. In some cases 48 hours. Leaves some holes in the process of protection and security, even legal holds. If you implement this method then you would have to reapply the policies again.
PowerShell could maybe help in this as well. Maybe release the label, open and close the document, and reapply the label to the file. I have done some amazing things with PowerShell but not sure this would be one that is successful. Depending on how many documents you have to apply this script to, it could take weeks or months to get this completed. Something maybe to look into. Not sure this helps but some ideas.
- N51768Feb 12, 2024Copper Contributor@ Montego services
Thank you for the update; I have planned below.
my SharePoint online is constantly running out of space, we have huge libraries with 1000 GB and 10000 Versions.
Using script, obtain all large libraries first. Exclude site from policy and Remove the Library versions using a script, set a 50-version limit, and then add the site back into the global policy.