← TenantTools365Blogone .sppkg · seven tools
TrimVersions365 · How-to

SharePoint won't let you keep fewer than 100 versions. Here's how to actually get to 5

The library settings page refuses anything under 100 major versions. PowerShell doesn't. Here is how to set a lower limit, what happens to existing versions, and how to see what a trim would delete before it deletes it.

Published 2026-07-31 · by HS Services

You open library settings, set major versions to 5, click OK, and SharePoint replies: For the number of major versions that may be stored, you must enter a number between 100 and 50000. One admin on Microsoft Q&A had 1.4 million files to fix and had raised the ticket "several times" before finding out the answer is: not through that page.

The floor is in the page, not the platform

The modern library-settings UI enforces 100 as a minimum. The platform does not. Anything that talks to SharePoint directly, PnP PowerShell, CSOM, the REST API, can set a lower number:

Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/Finance -Interactive

Set-PnPList -Identity 'Documents' -EnableVersioning $true -MajorVersions 5
Get-PnPList -Identity 'Documents' | Select-Object Title, MajorVersionLimit

Run it per library. If you have many, wrap it in Get-PnPList | Where-Object BaseTemplate -eq 101 and loop.

What a lower limit does — and doesn't — do

Lowering the limit changes what happens on the next save: SharePoint keeps the newest N versions of that file and drops the oldest. Files nobody touches again keep every version they have today.

So on a library where the storage problem is a thousand archived files with 200 versions each, setting the limit to 5 recovers nothing until those files are edited. To reclaim the space now you need to trim existing versions.

Trimming existing versions

Microsoft added on-demand trim jobs to the SharePoint Online Management Shell. They run server-side, asynchronously, and they delete permanently.

Connect-SPOService -Url https://contoso-admin.sharepoint.com
$site = 'https://contoso.sharepoint.com/sites/Finance'

# 1. What WOULD be deleted? (report only)
New-SPOSiteFileVersionExpirationReportJob -Identity $site -ReportUrl "$site/Shared Documents/version-report.csv"
Get-SPOSiteFileVersionExpirationReportJobProgress -Identity $site -ReportUrl "$site/Shared Documents/version-report.csv"

# 2. Then trim - pick ONE mode:
New-SPOSiteFileVersionBatchDeleteJob -Identity $site -MajorVersionLimit 5 -MajorWithMinorVersionsLimit 0   # keep newest 5 per file
# New-SPOSiteFileVersionBatchDeleteJob -Identity $site -DeleteBeforeDays 365                              # drop versions older than a year
# New-SPOSiteFileVersionBatchDeleteJob -Identity $site -Automatic                                          # Microsoft's intelligent thinning

Get-SPOSiteFileVersionBatchDeleteJobProgress -Identity $site

New-SPOListFileVersionBatchDeleteJob -Site $site -List 'Documents' ... does the same for one library.

Three things to know before pressing enter:

The bit that is genuinely hard by hand

The problem on the Q&A thread was not the command. It was confidence: which libraries have the bloat, how many GB a 5-version rule would reclaim per library, and which files would lose versions that someone might still want. The expiration report answers that per site, in a CSV nobody enjoys reading.

TrimVersions365 exists for that step: a free analysis that shows files, historical versions and estimated version storage per library; a What-if tab that shows exactly what a given policy would delete before it deletes anything; and an execute step that only ever removes old versions, never the current one and never the file. Under the hood it calls the same version-delete endpoint, one version at a time, with a record of what went.

Suggested order

  1. Set the going-forward limit with Set-PnPList (or intelligent versioning tenant-wide).
  2. Run the what-if for one big library.
  3. Trim that library, verify storage drops (allow 24–48 hours for the numbers to update).
  4. Repeat where it matters. Leave small libraries alone.

Questions people also ask

Why does SharePoint say the number of major versions must be between 100 and 50000?

The modern library-settings page enforces a floor of 100. It is a UI limit, not a platform one. PnP PowerShell (Set-PnPList -MajorVersions) accepts lower values, and the SharePoint Online version-trim jobs can enforce a count limit as low as you like.

If I lower the version limit, are old versions deleted immediately?

No. A new limit applies going forward; existing files keep their versions until the next save trims the oldest. To remove existing versions you need a trim job (New-SPOSiteFileVersionBatchDeleteJob) or a tool that deletes them.

How do I delete old versions in SharePoint Online in bulk?

Use New-SPOSiteFileVersionBatchDeleteJob or New-SPOListFileVersionBatchDeleteJob with a version count, an age, or automatic mode. Run the matching expiration-report job first to see what would be deleted. Deleted versions cannot be recovered.

Does version history count towards SharePoint storage?

Yes, every version's full size counts. A 20 MB deck saved 50 times is roughly 1 GB.