Commands › SharePoint Online

New-SPOFileArchivePolicy

SharePoint Online Microsoft.Online.SharePoint.PowerShell New-*

Creates a new file archive policy for the tenant.

Quick start script

# New-SPOFileArchivePolicy — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-SPOService -Url https://$org-admin.sharepoint.com

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-SPOFileArchivePolicy
$before | Format-List

# 3. Make the change
New-SPOFileArchivePolicy -PolicyType <SPOFileArchivePolicyType>

# 4. Verify and diff
$after = Get-SPOFileArchivePolicy
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

New-SPOFileArchivePolicy [-Name <String>] -PolicyType <SPOFileArchivePolicyType> [-LastAccessDateCriteria <Int32>]
 [-FileTypeCriteria <String[]>] [-IsWhatIfMode <Boolean>] [<CommonParameters>]

Parameters (5)

ParameterTypeRequiredWhat it controls
-FileTypeCriteria String[] Specifies an array of file extensions to include in the policy. Only files matching the specified extensions will be considered for archiving. Use the dot-prefixed format. If not specified, all file types are included.
-IsWhatIfMode Boolean Specifies whether the policy runs in `WhatIf` mode. When set to `$true`, the policy will evaluate which files meet the archiving criteria and report the results, but will not actually archive any files. When set to...
-LastAccessDateCriteria Int32 Specifies the number of months since a file was last accessed before it becomes eligible for archiving. Valid values range from 6 to 48. The default value is 24 months.
-Name String Specifies a display name for the policy. If not specified, defaults to "MyPolicy".
-PolicyType SPOFileArchivePolicyType yes Specifies whether the policy targets all sites in the tenant or only selected sites. Accepted values are `AllSites` and `SelectedSites`. If `SelectedSites` is chosen, you must add at least one site using...

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.