en-US

SPOFileArchivePolicy

Applies to : SharePoint Online

Updates an existing file archive policy.

This cmdlet updates the properties of an existing file archive policy. Only the parameters that are specified will be updated; all other properties remain unchanged. You cannot set the State to Active unless the PolicyType is AllSites or AllODBSites, or at least one site has been added to the policy using Add-SPOSiteToFileArchivePolicy.

Available cmdlets

Parameters

Name Type Default value Accepted values
FileTypeCriteria String[]
FileTypeExclusionCriteria String[]
IsWhatIfMode Boolean
LastAccessDateCriteria Int32
Name String
PolicyId Guid
PolicyType SPOFileArchivePolicyType AllSites, SelectedSites, AllODBSites
State SPOFileArchivePolicyState Active, Inactive

Examples

Example 1

Set-SPOFileArchivePolicy -PolicyId "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -State "Active"

Activates the specified file archive policy.

Example 2

Set-SPOFileArchivePolicy -PolicyId "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -Name "Updated Policy Name" -LastAccessDateCriteria 12

Updates the display name and changes the last access date criteria to 12 months for the specified policy.

Example 3

Set-SPOFileArchivePolicy -PolicyId "a1b2c3d4-e5f6-7890-abcd-ef1234567890" -IsWhatIfMode $true

Enables WhatIf mode on the specified policy. Future policy runs will report eligible files without archiving them.

Microsoft Learn documentation