Version history and Retention Policies - Why do I have so many versions?

Steel Contributor

We are using (I believe) the global default of 500 versions for document libraries in SharePoint Online and now we are discovering that the version history is accumulating more than 500 major versions on items in libraries. We have retention policies set for SharePoint sites (do not delete for X years). Is that overriding the version history settings? We have libraries in supporting MSTeams and Communication sites where files are well over the 500 major version limit. 6800+, 7900+

 

It's kind of insane... I'm not finding the documentation to answer my question very easily. It's also throwing a wrench into backup software that we are trying to run since it doesn't have a setting where it allows us to backup a maximum amount of versions.

7 Replies
Have you managed to resolve this?

@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. 

@Montegoservices
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.

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.

@Timothy Balk  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.

@ 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.

I'd run this strategy by your legal/compliance/information governance area and make sure they're OK with that... The deleted versions won't go to the recycle bin when they are deleted. So, it will effectively be deleted data that may be held and is in line with retention schedules. Maybe in talking about it, there will approve it and you'll have covered yourself should things be audited.

Link below is from a discussion about restoring deleted document versions and the accepted answer is that the specific document versions will not be restorable from the recycle bin.
https://techcommunity.microsoft.com/t5/microsoft-365/restoring-a-deleted-sharepoint-document-version...