spo folder retentionlabel ensure
Apply a retention label to a folder
Usage
m365 spo folder retentionlabel ensure [options]
Options
-u, --webUrl <webUrl>
URL of the site where the retention label from a file to apply is located.
--folderUrl [folderUrl]
The server- or site-relative decoded URL of the folder that should be labelled. Specify either
folderUrl
orfolderId
but not both.-i, --folderId [folderId]
The UniqueId (GUID) of the folder that should be labelled. Specify either
folderUrl
orfolderId
but not both.--name <name>
Name of the retention label to apply to the folder.
-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 isoptions
.--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]
Output type.
json
,text
,csv
,md
,none
. Defaultjson
.--verbose
Runs command with verbose logging.
--debug
Runs command with debug logging.
Remarks
You can also use spo listitem retentionlabel remove for removing the retention label from a list item.
Examples
Applies a retention label to a folder based on the label name and the folderUrl.
m365 spo folder retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --folderUrl '/Shared Documents' --name 'Some label'
Applies a retention label to a folder based on the label name and the folderId.
m365 spo folder retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --folderId '26541f96-017c-4189-a604-599e083533b8' --name 'Some label'
Response
The command won't return a response on success.