-
Notifications
You must be signed in to change notification settings - Fork 0
Home
GitHub Action edited this page Jul 15, 2026
·
8 revisions
SPSCleanVersions is a PowerShell script tool to clean Version History in your SharePoint Tenant. Optimize your storage costs by managing major and minor versions across libraries and lists.
-
Two Config Sources: Pass configuration inline via
-InputJson(ideal for Azure Automation Runbooks) or from a local JSON file via-ConfigFile(ideal for local execution and testing). Both share the same JSON schema and validation. -
Simulation Mode: Use
"DryRun": truein the JSON (or-WhatIflocally) to preview changes safely. - Flexible Retention: Define custom thresholds for major and minor versions.
-
Site Version Policy: Set
"VersionPolicyMode"toAutoExpiration,ExpireAfter,NoExpirationorInheritFromTenantto apply a site-level policy viaSet-PnPSiteVersionPolicy— including version expiration (ExpireVersionsAfterDays) and applying to new and/or existing libraries. The defaultLegacymode keeps the per-library count-based behaviour. -
Multi-Site Processing: Pass multiple Site Collection URLs in the
SiteUrlsJSON array to process them in a single execution. -
Force Delete Old Versions: Set
"ForceDeleteOldVersions": trueto trigger a batch delete job viaNew-PnPSiteFileVersionBatchDeleteJob. Requires delegated user context (automatically skipped in Azure Automation). - Azure Automation Ready: Single string parameter avoids all runbook type limitations (arrays, switches, booleans).
For details on usage, configuration, and parameters, explore the links below:
Navigation
Project