Skip to content

New Command: Lock Record Item that has been labeled by a Purview Retention Label #4237

@martinlingstuyl

Description

@martinlingstuyl

Usage

m365 spo listitem record lock [options]

Options

Option Description
-u, --webUrl <webUrl> The url of the web.
--listId [listId] ID of the list. Specify either listTitle, listId or listUrl.
--listTitle [listTitle] Title of the list. Specify either listTitle, listId or listUrl.
--listUrl [listUrl] Server- or site-relative URL of the list. Specify either listTitle, listId or listUrl.
--listItemId <listItemId> ID of the list item that should be locked.

Examples

Lock the list item record

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

Description

In Purview you can create retentionlabels with Record settings. For example you can configure items to be a record and set them as unlocked by default.
In the SharePoint UI, this results in an extra checkbox. As a user you can click this checkbox to lock the record. If the 'configure record versioning' tenant setting is enabled you can also unlock that record again.

image

It would be good to be able to do this with the CLI so you can automate the labelling process further.

More Information

The SharePoint UI sends the following HTTP request when locking an item:

POST https://contoso.sharepoint.com/sites/project-x/_api/SP.CompliancePolicy.SPPolicyStoreProxy.LockRecordItem()
Body: {"listUrl":"/sites/project-x/Shared Documents","itemId":"1"}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions