Skip to content

New Command: Unlock Record Item that has been labeled by a Purview Retention Label #4239

@martinlingstuyl

Description

@martinlingstuyl

Usage

m365 spo listitem record unlock [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 unlocked.

Examples

Unlock the list item record

m365 spo listitem record unlock --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 unlocking an item:

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

The 'configure record versioning' tenant setting should be enabled for unlocking to work. while developing, make sure you test both scenario's and see if any errors are properly returned. See Record settings in the Purview portal > Records Management > Records management settings
image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions