Skip to content

Commit c70465d

Browse files
martinlingstuylAdam-it
authored andcommitted
Adds new command spo listitem retentionlabel ensure. Closes pnp#4158
1 parent 35c5b87 commit c70465d

File tree

8 files changed

+587
-1
lines changed

8 files changed

+587
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# spo listitem retentionlabel ensure
2+
3+
Apply a retention label to a list item
4+
5+
## Usage
6+
7+
```sh
8+
m365 spo listitem retentionlabel ensure [options]
9+
```
10+
11+
## Options
12+
13+
`-u, --webUrl <webUrl>`
14+
: URL of the site where the retentionlabel from a listitem to apply is located
15+
16+
`--listItemId <listItemId>`
17+
: The ID of the list item for which the retention label should be applied.
18+
19+
`--listId [listId]`
20+
: ID of the list where the retention label should be applied. Specify either `listTitle`, `listId` or `listUrl`
21+
22+
`--listTitle [listTitle]`
23+
: Title of the list where the retention label should be applied. Specify either `listTitle`, `listId` or `listUrl`
24+
25+
`--listUrl [listUrl]`
26+
: Server- or site-relative URL of the list. Specify either `listTitle`, `listId` or `listUrl`
27+
28+
`-n, --name [name]`
29+
: The name of the retention label. Specify either `name` or `id`.
30+
31+
`-i, --id [id]`
32+
: The id of the retention label. Specify either `name` or `id`.
33+
34+
--8<-- "docs/cmd/_global.md"
35+
36+
## Examples
37+
38+
Applies the retention label _Some label_ to a list item in a given site based on the list id and label name
39+
40+
```sh
41+
m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listId 0cd891ef-afce-4e55-b836-fce03286cccf --listItemId 1 --name 'Some label'
42+
```
43+
44+
Applies a retention label to a list item in a given site based on the list title and label id
45+
46+
```sh
47+
m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'List 1' --listItemId 1 --id '7a621a91-063b-461b-aff6-d713d5fb23eb'
48+
```
49+
50+
Applies the retention label _Some label_ to a list item in a given site based on the server relative list url
51+
52+
```sh
53+
m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl /sites/project-x/lists/TestList --listItemId 1 --name 'Some label'
54+
```
55+
56+
## Response
57+
58+
The command won't return a response on success.

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ nav:
489489
- listitem remove: cmd/spo/listitem/listitem-remove.md
490490
- listitem attachment list: cmd/spo/listitem/listitem-attachment-list.md
491491
- listitem batch add: cmd/spo/listitem/listitem-batch-add.md
492+
- listitem retentionlabel ensure: cmd/spo/listitem/listitem-retentionlabel-ensure.md
492493
- listitem retentionlabel remove: cmd/spo/listitem/listitem-retentionlabel-remove.md
493494
- listitem roleassignment add: cmd/spo/listitem/listitem-roleassignment-add.md
494495
- listitem roleassignment remove: cmd/spo/listitem/listitem-roleassignment-remove.md

src/m365/spo/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export default {
147147
LISTITEM_RECORD_UNDECLARE: `${prefix} listitem record undeclare`,
148148
LISTITEM_RECORD_UNLOCK: `${prefix} listitem record unlock`,
149149
LISTITEM_REMOVE: `${prefix} listitem remove`,
150+
LISTITEM_RETENTIONLABEL_ENSURE: `${prefix} listitem retentionlabel ensure`,
150151
LISTITEM_RETENTIONLABEL_REMOVE: `${prefix} listitem retentionlabel remove`,
151152
LISTITEM_ROLEASSIGNMENT_ADD: `${prefix} listitem roleassignment add`,
152153
LISTITEM_ROLEASSIGNMENT_REMOVE: `${prefix} listitem roleassignment remove`,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface ListItemRetentionLabel {
2+
complianceTag: string;
3+
isTagPolicyHold: boolean;
4+
isTagPolicyRecord: boolean;
5+
isEventBasedTag: boolean;
6+
isTagSuperLock: boolean;
7+
isUnlockedAsDefault: boolean;
8+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export interface SiteRetentionLabel {
2+
AcceptMessagesOnlyFromSendersOrMembers: boolean;
3+
AccessType?: any;
4+
AllowAccessFromUnmanagedDevice?: any;
5+
AutoDelete: boolean;
6+
BlockDelete: boolean;
7+
BlockEdit: boolean;
8+
ComplianceFlags: number;
9+
ContainsSiteLabel: boolean;
10+
DisplayName: string;
11+
EncryptionRMSTemplateId?: any;
12+
HasRetentionAction: boolean;
13+
IsEventTag: boolean;
14+
MultiStageReviewerEmail?: any;
15+
NextStageComplianceTag?: any;
16+
Notes?: any;
17+
RequireSenderAuthenticationEnabled: boolean;
18+
ReviewerEmail?: any;
19+
SharingCapabilities?: any;
20+
SuperLock: boolean;
21+
TagDuration: number;
22+
TagId: string;
23+
TagName: string;
24+
TagRetentionBasedOn: string;
25+
UnlockedAsDefault: boolean;
26+
}

0 commit comments

Comments
 (0)