Skip to content

New command: Remove a retentionlabel from a listitem using spo listitem retentionlabel remove #4162

@martinlingstuyl

Description

@martinlingstuyl

Usage

m365 spo listitem retentionlabel remove [options]

Description

Clear the retention label from a list item

Options

Option Description
-u, --webUrl <webUrl> The url of the web.
-l, --listId [listId] ID of the list where the item label should be removed. Specify either listTitle, listId or listUrl
-t, --listTitle [listTitle] Title of the list where the item label should be removed. Specify either listTitle, listId or listUrl
--listUrl [listUrl] Server- or site-relative URL of the list where the item label should be removed. Specify either listTitle, listId or listUrl
-i, --listItemId <listItemId> ID of the list item for which the label should be removed.
--confirm Don't prompt for confirming to remove the label.

Remarks

If the item has been marked as a record by the label, it may not be possible to remove it.

Examples

Remove a label from a list item

m365 spo listitem retentionlabel remove --webUrl 'https://contoso.sharepoint.com/sites/sales' --listTitle 'some list' --listItemId 1

More information

This command can be implemented with shared code in a util, so that new commands spo file retentionlabel remove and spo folder retentionlabel remove can profit from the same code.

The SharePoint User Interface executes the following when clearing a label:

POST to https://contoso.sharepoint.com/sites/project-x/_api/web/GetList(@a1)/items(@a2)/SetComplianceTag()?@a1='/sites/project-x/Lists/some-list'&@a2='1'

Payload:

{
    "complianceTag":"", 
    "isTagPolicyHold":false,
    "isTagPolicyRecord":false,
    "isEventBasedTag":false,
    "isTagSuperLock":false,
    "isUnlockedAsDefault":false
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions