|
| 1 | +--- |
| 2 | +Module Name: PnP.PowerShell |
| 3 | +title: Reset-PnPRetentionLabel |
| 4 | +schema: 2.0.0 |
| 5 | +applicable: SharePoint Online |
| 6 | +external help file: PnP.PowerShell.dll-Help.xml |
| 7 | +online version: https://pnp.github.io/powershell/cmdlets/Reset-PnPRetentionLabel.html |
| 8 | +--- |
| 9 | + |
| 10 | +# Reset-PnPRetentionLabel |
| 11 | + |
| 12 | +## SYNOPSIS |
| 13 | +Resets a retention label on the specified list or library to None, or resets a retention label on specified list items in a list or a library |
| 14 | + |
| 15 | +## SYNTAX |
| 16 | + |
| 17 | +### Reset on a list |
| 18 | +```powershell |
| 19 | +Reset-PnPRetentionLabel [-List] <ListPipeBind> [-SyncToItems <Boolean>] |
| 20 | + [-Connection <PnPConnection>] |
| 21 | +``` |
| 22 | + |
| 23 | +### Reset on items in bulk |
| 24 | +```powershell |
| 25 | +Reset-PnPRetentionLabel [-List] <ListPipeBind> -ItemIds <List<Int32>> [-BatchSize <Int32>] |
| 26 | + [-Connection <PnPConnection>] [-Verbose] |
| 27 | +``` |
| 28 | + |
| 29 | +## DESCRIPTION |
| 30 | +Removes the retention label on a list or library and its items, or removes the retention label from specified items in a list or a library. Does not work for sensitivity labels. |
| 31 | +When resetting retention label on specified items, cmdlet allows passing of unlimited number of items - items will be split and processed in batches (CSOM method SetComplianceTagOnBulkItems has a hard count limit on number of processed items in one go). If needed, batch size may be adjusted with BatchSize parameter. |
| 32 | + |
| 33 | +## EXAMPLES |
| 34 | + |
| 35 | +### EXAMPLE 1 |
| 36 | +```powershell |
| 37 | +Reset-PnPRetentionLabel -List "Demo List" |
| 38 | +``` |
| 39 | + |
| 40 | +This resets an O365 label on the specified list or library to None |
| 41 | + |
| 42 | +### EXAMPLE 2 |
| 43 | +```powershell |
| 44 | +Reset-PnPRetentionLabel -List "Demo List" -SyncToItems $true |
| 45 | +``` |
| 46 | + |
| 47 | +This resets an O365 label on the specified list or library to None and resets the label on all the items in the list and library except Folders and where the label has been manually or previously automatically assigned |
| 48 | + |
| 49 | +### EXAMPLE 3 |
| 50 | +```powershell |
| 51 | +Set-PnPRetentionLabel -List "Demo List" -ItemIds @(1,2,3) |
| 52 | +``` |
| 53 | + |
| 54 | +This clears a retention label from items with ids 1, 2 and 3 on a list "Demo List" |
| 55 | + |
| 56 | +## PARAMETERS |
| 57 | + |
| 58 | +### -BatchSize |
| 59 | +Optional batch size when resetting a label on specified items. |
| 60 | + |
| 61 | +```yaml |
| 62 | +Type: Int32 |
| 63 | +Parameter Sets: (BulkItems) |
| 64 | + |
| 65 | +Required: True |
| 66 | +Position: Named |
| 67 | +Default value: 25 |
| 68 | +Accept pipeline input: False |
| 69 | +Accept wildcard characters: False |
| 70 | +``` |
| 71 | +
|
| 72 | +### -Connection |
| 73 | +Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. |
| 74 | +
|
| 75 | +```yaml |
| 76 | +Type: PnPConnection |
| 77 | +Parameter Sets: (All) |
| 78 | + |
| 79 | +Required: False |
| 80 | +Position: Named |
| 81 | +Default value: None |
| 82 | +Accept pipeline input: False |
| 83 | +Accept wildcard characters: False |
| 84 | +``` |
| 85 | +
|
| 86 | +### -ItemIds |
| 87 | +List of iist item IDs to reset label. |
| 88 | +
|
| 89 | +```yaml |
| 90 | +Type: List<Int32> |
| 91 | +Parameter Sets: (BulkItems) |
| 92 | + |
| 93 | +Required: True |
| 94 | +Position: Named |
| 95 | +Default value: None |
| 96 | +Accept pipeline input: False |
| 97 | +Accept wildcard characters: False |
| 98 | +``` |
| 99 | +
|
| 100 | +### -List |
| 101 | +The ID or Url of the list |
| 102 | +
|
| 103 | +```yaml |
| 104 | +Type: ListPipeBind |
| 105 | +Parameter Sets: (All) |
| 106 | + |
| 107 | +Required: True |
| 108 | +Position: 0 |
| 109 | +Default value: None |
| 110 | +Accept pipeline input: True (ByValue) |
| 111 | +Accept wildcard characters: False |
| 112 | +``` |
| 113 | +
|
| 114 | +### -SyncToItems |
| 115 | +Reset label on existing items in the library |
| 116 | +
|
| 117 | +```yaml |
| 118 | +Type: Boolean |
| 119 | +Parameter Sets: (List) |
| 120 | + |
| 121 | +Required: False |
| 122 | +Position: Named |
| 123 | +Default value: None |
| 124 | +Accept pipeline input: False |
| 125 | +Accept wildcard characters: False |
| 126 | +``` |
| 127 | +
|
| 128 | +### -Verbose |
| 129 | +When provided, additional debug statements will be shown while executing the cmdlet. |
| 130 | +
|
| 131 | +```yaml |
| 132 | +Type: SwitchParameter |
| 133 | +Parameter Sets: (All) |
| 134 | + |
| 135 | +Required: False |
| 136 | +Position: Named |
| 137 | +Default value: None |
| 138 | +Accept pipeline input: False |
| 139 | +Accept wildcard characters: False |
| 140 | + |
| 141 | + |
| 142 | +## RELATED LINKS |
| 143 | + |
| 144 | +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) |
| 145 | +[Microsoft Learn article on applying retention labels](https://learn.microsoft.com/en-us/sharepoint/dev/apis/csom-methods-for-applying-retention-labels) |
| 146 | + |
| 147 | + |
0 commit comments