pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
896 stars 318 forks source link

New command: Clears a default sensitivity label from a document library #4717

Open nicodecleyre opened 1 year ago

nicodecleyre commented 1 year ago

Usage

m365 spo list sensitivitylabel remove [options]

Description

Clears a default sensitivity label from a document library

Options

Option Description
-u, --webUrl <webUrl> The URL of the site where the list is located.
-t, --listTitle [listTitle] The title of the library on which to remove the label. Specify either listTitle, listId, or listUrl but not multiple.
-l, --listId [listId] The ID of the library on which to remove the label. Specify either listTitle, listId, or listUrl but not multiple.
--listUrl [listUrl] Server- or web-relative URL of the library on which to remove the label. Specify either listTitle, listId, or listUrl but not multiple.
-f, --force Don't prompt for confirmation.

Examples

Removes a sensitivity label on a document library based on the list title

m365 spo list sensitivitylabel remove --webUrl 'https://contoso.sharepoint.com' --listTitle 'Shared Documents'

Removes a sensitivity label on a document library based on the list url

m365 spo list sensitivitylabel remove --webUrl 'https://contoso.sharepoint.com' --listUrl '/Shared Documents'

Removes a sensitivity label on a document library based on the list id. Doesn't prompt for confirmation.

m365 spo list sensitivitylabel remove --webUrl 'https://contoso.sharepoint.com' --listId 'b4cfa0d9-b3d7-49ae-a0f0-f14ffdd005f7' --force

Default properties

No response

Additional Info

This can be archieved by doing: 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

{
     if-match: *
}

body

{
    "DefaultSensitivityLabelForLibrary": ""
}

on success the api returns a 204 No Content

martinlingstuyl commented 1 year ago

Very nice @nicodecleyre! And this is an extra reason to have the listTitle optionSet on file level as well: consistency between the commands.

martinlingstuyl commented 1 year ago

I did some textual changes and opened it up 👍

ktskumar commented 1 year ago

May I work on this!

Jwaegebaert commented 1 year ago

Awesome @ktskumar, this issue is all yours!

Jwaegebaert commented 10 months ago

Hey @ktskumar, are you still working on this?

ktskumar commented 10 months ago

Hey @ktskumar, are you still working on this?

Yep. I missed this item from my bucket list. Will push my code asap.

milanholemans commented 6 months ago

@ktskumar are you still working on this?

waldekmastykarz commented 1 month ago

Resetting due to lack of response