Usage
m365 spo list sensitivitylabel ensure [options]
Description
Apply a default sensitivity label to a document library
Options
| Option |
Description |
-u, --webUrl <webUrl> |
The URL of the site where the library is located. |
--name <name> |
The label name to apply to the list. |
-t, --listTitle [listTitle] |
The title of the library on which to set the label. Specify either listTitle, listId, or listUrl but not multiple. |
-l, --listId [listId] |
The ID of the library on which to set the label. Specify either listTitle, listId, or listUrl but not multiple. |
--listUrl [listUrl] |
Server- or web-relative URL of the library on which to set the label. Specify either listTitle, listId, or listUrl but not multiple. |
Examples
Applies a sensitivity label to a document library based on the list title
m365 spo list sensitivitylabel ensure --webUrl 'https://contoso.sharepoint.com' --listTitle 'Shared Documents' --name 'Label'
Applies a sensitivity label to a document library based on the list url
m365 spo list sensitivitylabel ensure --webUrl 'https://contoso.sharepoint.com' --listUrl '/Shared Documents' --name 'Label'
Applies a sensitivity label 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 'Label'
Default properties
No response
Additional Info
This can be archieved by doing:
First getting the Sensitivity Label ID which should be applied, this can be done by doing:
GET https://graph.microsoft.com/beta/security/informationProtection/sensitivityLabels, here an in code filtering should be done based on the name property.
Secondly: PATCH https://contoso.sharepoint.com/sites/testcomm/_api/web/lists(guid'[List ID]')
or PATCH https://contoso.sharepoint.com/sites/testcomm/_api/web/lists/getByTitle('[List Title]')
or PATCH https://contoso.sharepoint.com/sites/testcomm/_api/web/GetList([List server relative URL])
headers
body
{
"DefaultSensitivityLabelForLibrary": [Sensitivity label ID]
}
on success the api returns a 204 No Content
Usage
m365 spo list sensitivitylabel ensure [options]
Description
Apply a default sensitivity label to a document library
Options
-u, --webUrl <webUrl>--name <name>-t, --listTitle [listTitle]listTitle,listId, orlistUrlbut not multiple.-l, --listId [listId]listTitle,listId, orlistUrlbut not multiple.--listUrl [listUrl]listTitle,listId, orlistUrlbut not multiple.Examples
Applies a sensitivity label to a document library based on the list title
Applies a sensitivity label to a document library based on the list url
Applies a sensitivity label to a document library based on the list id
Default properties
No response
Additional Info
This can be archieved by doing:
First getting the Sensitivity Label ID which should be applied, this can be done by doing:
GET https://graph.microsoft.com/beta/security/informationProtection/sensitivityLabels, here an in code filtering should be done based on thenameproperty.Secondly:
PATCH https://contoso.sharepoint.com/sites/testcomm/_api/web/lists(guid'[List ID]')or
PATCH https://contoso.sharepoint.com/sites/testcomm/_api/web/lists/getByTitle('[List Title]')or
PATCH https://contoso.sharepoint.com/sites/testcomm/_api/web/GetList([List server relative URL])headers
body
on success the api returns a 204 No Content