Skip to main content

spo listitem retentionlabel ensure

Apply a retention label to a list item

Usage

m365 spo listitem retentionlabel ensure [options]

Options

-u, --webUrl <webUrl>

URL of the site where the retentionlabel from a list item to apply is located.

--listItemId <listItemId>

The ID of the list item for which the retention label should be applied.

--listId [listId]

ID of the list where the retention label should be applied. Specify either listTitle, listId or listUrl.

--listTitle [listTitle]

Title of the list where the retention label should be applied. Specify either listTitle, listId or listUrl.

--listUrl [listUrl]

Server- or site-relative URL of the list. Specify either listTitle, listId or listUrl.

-n, --name [name]

The name of the retention label. Specify either name or id.

-i, --id [id]

The id of the retention label. Specify either name or id.

-a, --assetId [assetId]

A Compliance Asset Id to set on the item when it's labeled. See below for more information.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

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.

Examples

Applies a retention label to a list item in a given site based on the list id and label name

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

Applies a retention label to a list item in a given site based on the list title and label id

m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'List 1' --listItemId 1 --id '7a621a91-063b-461b-aff6-d713d5fb23eb'

Applies a retention label to a list item in a given site based on the server relative list url

m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl /sites/project-x/lists/TestList --listItemId 1 --name 'Some label'

Applies a retention label to a list item in a given site based on the server relative list url and updates the Asset Id field

m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl /sites/project-x/lists/TestList --listItemId 1 --name 'Some label' --assetId 'XYZ'

Response

The command won't return a response on success.

CTRL + M