New-SPOContainerTenantApplyFileVersionPolicyJob

Queues a job to apply a file version policy across all containers of a SharePoint Embedded (SPE) container type. SharePoint Advanced Management license or Copilot license is required to run this cmdlet.

Note

This feature is currently in preview and may not be available in your tenant.

Syntax

WithExistingVersionPolicy (Default)

New-SPOContainerTenantApplyFileVersionPolicyJob
    -ContainerTypeId <Guid>
    [-TrimVersions]
    [-SetVersionPolicy]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

WithVersionPolicy

New-SPOContainerTenantApplyFileVersionPolicyJob
    -ContainerTypeId <Guid>
    -VersionPolicy <SPOFileVersionPolicySettings>
    [-TrimVersions]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CollectData

New-SPOContainerTenantApplyFileVersionPolicyJob
    -ContainerTypeId <Guid>
    [-CollectVersionData]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Queues a job to apply a file version policy across all containers that belong to the specified SharePoint Embedded (SPE) container type. The job trims existing file versions and/or sets version policy for existing containers based on the version policy supplied for the container type.

Note

  • Versions deleted using this cmdlet will be permanently deleted and cannot be recovered from the recycle bin.
  • Only one job is allowed per container type.
  • Use -CollectVersionData first and wait for the job to complete before running Get-SPOContainerTenantApplyFileVersionPolicyJobImpact to estimate the impact of a policy without deleting any versions.

Examples

Example 1

New-SPOContainerTenantApplyFileVersionPolicyJob -ContainerTypeId <ContainerTypeId> -TrimVersions -SetVersionPolicy

Example 1 starts a job to trim existing versions and set version policy for existing containers of the specified container type.

Example 2

New-SPOContainerTenantApplyFileVersionPolicyJob -ContainerTypeId <ContainerTypeId> -TrimVersions

Example 2 starts a job to trim existing versions for files in containers of the specified container type.

Example 3

New-SPOContainerTenantApplyFileVersionPolicyJob -ContainerTypeId <ContainerTypeId> -SetVersionPolicy

Example 3 starts a job to set version policy for existing containers of the specified container type.

Example 4

New-SPOContainerTenantApplyFileVersionPolicyJob -ContainerTypeId <ContainerTypeId> -CollectVersionData

Example 4 starts a job to collect version data across all containers of the specified container type. Once the job completes, use Get-SPOContainerTenantApplyFileVersionPolicyJobImpact to estimate the impact of a version policy without deleting any versions.

Example 5

$policy = Get-SPOTenantVersionPolicy | Get-SPOVersionPolicyWithChanges -MajorVersionLimit 100
New-SPOContainerTenantApplyFileVersionPolicyJob -ContainerTypeId <ContainerTypeId> -TrimVersions -VersionPolicy $policy

Example 5 builds a version policy that limits to 100 major versions locally, then starts a trim job that applies that policy to the specified container type.

Parameters

-CollectVersionData

Collects version data across all containers of the container type for use with Get-SPOContainerTenantApplyFileVersionPolicyJobImpact. Use this switch to run a data-collection pass before deciding whether and how to trim versions. The job does not delete any versions. Cannot be combined with -VersionPolicy or -SetVersionPolicy.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CollectData
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ContainerTypeId

The ID of the SharePoint Embedded container type to which the job applies.

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

-SetVersionPolicy

Sets version policy for existing containers of the container type based on the container-type file version policy. The version policy applies to new versions created in these existing containers. Cannot be combined with -VersionPolicy or -CollectVersionData.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WithExistingVersionPolicy
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TrimVersions

Trims existing versions for files in containers of the container type based on the container-type file version policy.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WithExistingVersionPolicy
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
WithVersionPolicy
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VersionPolicy

The version policy to apply to the container type before starting the job. When specified, the container-type version policy is updated and propagated to its containers. Optionally combine with -TrimVersions to also trim existing versions.

Use Get-SPOTenantVersionPolicy and Get-SPOVersionPolicyWithChanges to build this value.

Parameter properties

Type:SPOFileVersionPolicySettings
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

WithVersionPolicy
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

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.

Inputs

None

Outputs

System.Object