Skip to content

Enhancement: add assetId option to retentionlabel ensure commands #4387

@martinlingstuyl

Description

@martinlingstuyl

To use event-based retention, your files need to be labeled with a retentionlabel connected to a retention event type. But they need something else: a Compliance Asset ID. This is a field that SharePoint automatically shows in the UI whenever you label a file or list item with an event based label.

When labeling files using the CLI, you would need to set it separately using spo listitem set command.
We can do one better though, allow to configure it while labeling, all in the same retentionlabel ensure command.

Options

The following option needs to be added to the two retentionlabel ensure commands:

Option Description
-a, --assetId [assetId] A Compliance Asset Id to set on the item after it's labeled. See below for more information.

Commands impacted

The following commands need the extra option:

  • spo file retentionlabel ensure
  • spo listitem retentionlabel ensure

Setting it on a folder or list is a no go. These labels function as default labels. Folders and lists are not impacted by retention. Only files and list items are.

Examples

Applies the retention label Some label to a list item in a given site and configures a Compliance Asset ID

m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listId 0cd891ef-afce-4e55-b836-fce03286cccf --listItemId 1 --name 'Some label' --assetId '1234'

Remarks

The commands should throw an error saying 'the label that's being applied is not an event-based label' if people use the assetId option together with a normal (non event-based label)

More information

This section should be included in the documentation

The --assetId option has to do with event-based retention. Event-based retention is about starting a retention period when a specific event occurs, instead of the moment a document was labeled or created.

Read more on event-based retention here

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions