Skip to content

spo list retentionlabel ensure

Sets a default retention label on the specified list or library.

Usage

m365 spo list retentionlabel ensure [options]

Alias

m365 spo list label set [options]

Options

-u, --webUrl <webUrl>
The URL of the site where the list is located.
--name <name>
The label name to set on the list.
--label <label>
(deprecated. Use name instead) The label name to set on the list.
-t, --listTitle [listTitle]
The title of the list on which to set the label. Specify either listTitle, listId, or listUrl but not multiple.
-l, --listId [listId]
The ID of the list on which to set the label. Specify either listTitle, listId, or listUrl but not multiple.
--listUrl [listUrl]
Server- or web-relative URL of the list on which to set the label. Specify either listTitle, listId, or listUrl but not multiple.
--syncToItems
Specify, to set the label on all existing items in the list.
--blockDelete
(deprecated) Specify, to disallow deleting items in the list.
--blockEdit
(deprecated) Specify, to disallow editing items in the list.
-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 full.
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text,csv,md. Default json
--verbose
Runs command with verbose logging
--debug
Runs command with debug logging

Remarks

A list retention label is a default label that will be applied to all new items in the list. If you specify syncToItems, it is also synced to existing items.

Examples

Sets a retention label by name on a given list.

m365 spo list retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl 'Shared Documents' --name 'Some label'

Sets a retention label by name and disables editing and deleting items on the list and all existing items for a given list.

m365 spo list retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'Documents' --name 'Some label' --blockEdit --blockDelete --syncToItems

Response

The command won't return a response on success.