Skip to main content

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 name or id, but not both.

-i, --id [id]

The Id of the label to apply to the list. Specify either name or id, but not both.

-t, --listTitle [listTitle]

The title of the library on which to apply the label. Specify either listTitle, listId, or listUrl but not multiple.

-l, --listId [listId]

The ID of the library on which to apply the label. Specify either listTitle, listId, or listUrl but not multiple.

--listUrl [listUrl]

Server- or web-relative URL of the library on which to apply the label. Specify either listTitle, listId, or listUrl but 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, 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

warning

This command is based on an API that is currently in preview and is subject to change once the API reaches general availability.

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.

CTRL + M