feat: add site version policy modes (Set-PnPSiteVersionPolicy) with expiration - #12
Merged
Conversation
Add a VersionPolicyMode property that selects between the existing per-library count-based path (Legacy, default) and new site-level modes driven by Set-PnPSiteVersionPolicy: AutoExpiration, ExpireAfter, NoExpiration and InheritFromTenant. Adds ExpireVersionsAfterDays and ApplyTo (New/Existing/Both) with validation (0 or >= 30 days), a Set-SiteVersionPolicy helper honouring ShouldProcess/WhatIf, and keeps the legacy behaviour fully backward compatible. Bump to 3.1.0. Refs #11
Add static assertions for the Set-SiteVersionPolicy helper, mode mapping and ApplyTo, plus a functional context validating the ExpireVersionsAfterDays rules (0 or >= 30, ExpireAfter requires >= 30). 79 tests pass. Refs #11
…rsionsAfterDays, ApplyTo) Add a 3.1.0 section to CHANGELOG, trim RELEASE-NOTES to the latest version, and document the new site version policy properties and modes in the Configuration/Usage/Home wiki pages and README. Refs #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #11
Summary
Adds first-class support for the modern SharePoint Online version-history model via
Set-PnPSiteVersionPolicy, including the customer-requested version expiration (ExpireVersionsAfterDays). The existing per-library count-basedSet-PnPListbehaviour is kept and remains the default.New JSON properties
VersionPolicyModeLegacy(default) /AutoExpiration/ExpireAfter/NoExpiration/InheritFromTenantExpireVersionsAfterDaysExpireAfter;NoExpirationforces 0.ApplyToNew/Existing/Both(defaultBoth)KeepMajorVersions->-MajorVersions,KeepMinorVersions->-MajorWithMinorVersions.Mode mapping
AutoExpiration->-EnableAutoExpirationVersionTrim $trueExpireAfter->-EnableAutoExpirationVersionTrim $false -ExpireVersionsAfterDays <n>=30> -MajorVersions <n> [-MajorWithMinorVersions <n>]NoExpiration->-EnableAutoExpirationVersionTrim $false -ExpireVersionsAfterDays 0 -MajorVersions <n>InheritFromTenant->-InheritFromTenantChanges
Set-SiteVersionPolicyhelper honouring ShouldProcess/WhatiF/DryRun; per-site branch selecting Legacy vs site-policy path.ExpireVersionsAfterDaysmust be 0 or >= 30;ExpireAfterrequires >= 30;VersionPolicyMode/ApplyTovalidated against allowed sets.Scope
Targets the configured
SiteUrls. Enumerating all tenant sites (Get-PnPTenantSite) is a planned follow-up.Notes
No breaking change: default
Legacymode preserves existing behaviour.