Skip to content

New command: Create a purview retention label #4147

@martinlingstuyl

Description

@martinlingstuyl

Usage

m365 purview retentionlabel add [options]

Description

Create a retention label

Options

Option Description
-n, --displayName <displayName> The display name of the label
--behaviorDuringRetentionPeriod <behaviorDuringRetentionPeriod> Specifies how the behavior of a document with this label should be during the retention period. Allowed values: doNotRetain, retain, retainAsRecord, retainAsRegulatoryRecord.
-actionAfterRetentionPeriod <actionAfterRetentionPeriod> Specifies the action to take on a document with this label applied after the retention period. Allowed values: none, delete, startDispositionReview.
--retentionDuration <retentionDuration> The number of days to retain the content.
-t, --retentionTrigger [retentionTrigger] Specifies whether the retention duration is calculated from the content creation date, labeled date, or last modification date. Allowed values: dateLabeled, dateCreated, dateModified, dateOfEvent. Defaults to dateLabeled.
--defaultRecordBehavior [defaultRecordBehavior] Specifies the locked or unlocked state of a record label when it is created. Allowed values: startLocked, startUnlocked, Defaults to startlocked.
--descriptionForUsers [descriptionForUsers] The label information for the user
--descriptionForAdmins [descriptionForAdmins] The label information for the admin
--labelToBeApplied [labelToBeApplied] Specifies the replacement label to be applied automatically after the retention period of the current label ends.

Examples

Create a retention label that retains documents as records and deletes them after one year.

m365 purview retentionlabel add --displayName 'some label' --behaviorDuringRetentionPeriod retainAsRecord --actionAfterRetentionPeriod delete --retentionDuration 365

Create a retention label that retains documents as regulatory records and starts a disposition review one year after the last modification date.

m365 purview retentionlabel add --displayName 'some label' --behaviorDuringRetentionPeriod retainAsRegulatoryRecord --actionAfterRetentionPeriod startDispositionReview --retentionDuration 365 --retentionTrigger dateModified

Additional Info

The following Graph endpoint can be used:
https://graph.microsoft.com/beta/security/labels/retentionLabels/{id}

More information

Further points of interest:

  • The documentation mentions unknownFutureValue as a possible value for the options retentionTrigger, actionAfterRetentionPeriod, defaultRecordBehavior and behaviorDuringRetentionPeriod. As these are obvious placeholders, I've excluded them here.
  • labelToBeApplied can probably contain an empty string if not used.
  • I've excluded dispositionReviewStages from the option list as the setup for this is as of yet unclear.

Beta notice

The Graph endpoint that's used is in beta, so we should add a beta notice to the docs.

Azure AD

The command will need the Scope RecordsManagement.ReadWrite.All.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions