← TenantTools365Blogone .sppkg · seven tools
TrimVersions365 · Troubleshooting

One SharePoint file has 3,000 versions. Find the writer before you trim

A single file with thousands of versions is never a person editing. It is a flow, a sync loop, a Power BI refresh or a script saving on a schedule. Trimming buys a week; fixing the writer buys forever.

Published 2026-08-10 · by HS Services

A version-storage audit almost always ends with one surprise: a single, boring file — Sales dashboard.xlsx, export.csv, status.pptx — with more versions than the rest of the library combined. Nobody edited it 3,000 times. Something did.

Find the files

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

$lib = 'Documents'
Get-PnPListItem -List $lib -PageSize 2000 -Fields FileRef,File_x0020_Size |
  Where-Object FileSystemObjectType -eq 'File' |
  ForEach-Object {
    $v = Get-PnPFileVersion -Url $_['FileRef']
    [pscustomobject]@{ Path = $_['FileRef']; Versions = $v.Count; VersionsMB = [math]::Round(($v | Measure-Object Size -Sum).Sum/1MB,0) }
  } |
  Sort-Object Versions -Descending | Select-Object -First 20 | Format-Table -AutoSize

It is one call per file, so on a 100,000-file library run it per folder or overnight. The top five are what you came for.

Identify the writer

Open the file → Version history. Look at Modified By and the spacing of the timestamps:

The audit log confirms it: FileModified events on that path, filtered by user agent (OneDrive, Power Automate, Microsoft.Data.Mashup).

Fix the writer

Then reclaim the space

For one file: Version history → Delete All Versions (keeps the current one). In PowerShell:

Remove-PnPFileVersion -Url '/sites/Sales/Shared Documents/Sales dashboard.xlsx' -All -Force

For a library where several files are affected, a version trim with a count limit does it in one job; see how to trim existing versions. Either way it is permanent, so look first.

The pattern is the point

The reason to rank files by versions rather than just set a limit is that the limit hides the cause. A library with a 100-version cap and a flow saving a file every ten minutes stays at 100 versions of that file forever — 100 × 40 MB, refreshed daily, still counting against the quota. Ranking by historical versions per file, which TrimVersions365's free analysis shows for every library on the site, is how you find the writer.

Questions people also ask

Why does a SharePoint file have so many versions?

Something is saving it repeatedly — an Excel file refreshed by a flow or a data connection, a file re-uploaded on a schedule, a sync client in a conflict loop, or Office autosave on a shared file that many people keep open. Version history shows the Modified By for each version, which identifies it.

How do I find files with the most versions in SharePoint?

In PowerShell, iterate the library with Get-PnPListItem and read each file's version count (Get-PnPFileVersion), or use the version-storage analysis in a tool that ranks files by historical versions.

How do I delete all versions of a single file in SharePoint?

Open the file's Version history and use Delete All Versions (keeps only the current), or in PowerShell Remove-PnPFileVersion with -All. Deleted versions cannot be recovered.