spo list sensitivitylabel ensure
Applies a default sensitivity label to the specified document library
Usage
m365 spo list sensitivitylabel ensure [options]
Options
-u, --webUrl <webUrl>The URL of the site where the library is located.
-n, --name [name]The label name to apply to the list. Specify either
nameorid, but not both.-i, --id [id]The Id of the label to apply to the list. Specify either
nameorid, but not both.-t, --listTitle [listTitle]The title of the library on which to apply the label. Specify either
listTitle,listId, orlistUrlbut not multiple.-l, --listId [listId]The ID of the library on which to apply the label. Specify either
listTitle,listId, orlistUrlbut not multiple.--listUrl [listUrl]Server- or web-relative URL of the library on which to apply the label. Specify either
listTitle,listId, orlistUrlbut not multiple.
-h, --help [help]Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options,examples,remarks,permissions,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.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Remarks
This command is based on an API that is currently in preview and is subject to change once the API reaches general availability.
Permissions
- Delegated
- Application
| Resource | Permissions |
|---|---|
| Microsoft Graph | InformationProtectionPolicy.Read |
| SharePoint | AllSites.Write |
| Resource | Permissions |
|---|---|
| Microsoft Graph | InformationProtectionPolicy.Read.All |
| SharePoint | Sites.ReadWrite.All |
Examples
Applies a sensitivity label by id to a document library based on the list title.
m365 spo list sensitivitylabel ensure --webUrl 'https://contoso.sharepoint.com' --listTitle 'Shared Documents' --id '0d39dc11-75ff-4309-8b32-ff94f0e41607'
Applies a sensitivity label by name to a document library based on the list title.
m365 spo list sensitivitylabel ensure --webUrl 'https://contoso.sharepoint.com' --listTitle 'Shared Documents' --name 'Confidential'
Applies a sensitivity label by name to a document library based on the list url.
m365 spo list sensitivitylabel ensure --webUrl 'https://contoso.sharepoint.com' --listUrl '/Shared Documents' --name 'Confidential'
Applies a sensitivity label by name to a document library based on the list id.
m365 spo list sensitivitylabel ensure --webUrl 'https://contoso.sharepoint.com' --listId 'b4cfa0d9-b3d7-49ae-a0f0-f14ffdd005f7' --name 'Confidential'
Response
The command won't return a response on success.