Set-SPOFileArchivePolicy
Updates an existing file archive policy.
Syntax
Default (Default)
Set-SPOFileArchivePolicy
-PolicyId <Guid>
[-Name <String>]
[-PolicyType <SPOFileArchivePolicyType>]
[-LastAccessDateCriteria <Int32>]
[-FileTypeCriteria <String[]>]
[-IsWhatIfMode <Boolean>]
[-State <SPOFileArchivePolicyState>]
[<CommonParameters>]
Description
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 at least one site has been added to the policy using Add-SPOSiteToFileArchivePolicy.
Note
This cmdlet is part of the file archive policies feature which is currently in preview.
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.
Parameters
-FileTypeCriteria
Specifies an updated 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. Set to $null to include all file types.
Parameter properties
| Type: | String[] |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-IsWhatIfMode
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 $false, the policy archives files normally when active.
Parameter properties
| Type: | Boolean |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-LastAccessDateCriteria
Specifies the updated number of months since a file was last accessed before it becomes eligible for archiving. Valid values range from 6 to 48.
Parameter properties
| Type: | Int32 |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Name
Specifies an updated display name for the policy.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-PolicyId
Specifies the unique identifier (GUID) of the policy to update.
Parameter properties
| Type: | Guid |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-PolicyType
Specifies the updated policy type. Accepted values are AllSites (targets all sites in the tenant) and SelectedSites (targets only sites explicitly added to the policy).
Parameter properties
| Type: | SPOFileArchivePolicyType |
| Default value: | None |
| Accepted values: | AllSites, SelectedSites |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-State
Specifies the updated state of the policy. Accepted values are Active and Inactive. A policy cannot be set to Active unless its PolicyType is AllSites or at least one site has been added to it.
Parameter properties
| Type: | SPOFileArchivePolicyState |
| Default value: | None |
| Accepted values: | Active, Inactive |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.