Set-PnPLabel
SYNOPSIS
Sets a retention label on the specified list or library. Use Reset-PnPLabel to remove the label again.
SYNTAX
Set-PnPLabel [-List] <ListPipeBind> -Label <String> [-SyncToItems <Boolean>] [-BlockDeletion <Boolean>]
[-BlockEdit <Boolean>] [-Connection <PnPConnection>]
DESCRIPTION
Allows setting a retention label on a list or library and its items. Does not work for sensitivity labels.
EXAMPLES
EXAMPLE 1
Set-PnPLabel -List "Demo List" -Label "Project Documentation"
This sets an O365 label on the specified list or library.
EXAMPLE 2
Set-PnPLabel -List "Demo List" -Label "Project Documentation" -SyncToItems $true
This sets an O365 label on the specified list or library and sets the label to all the items in the list and library as well.
PARAMETERS
-BlockDeletion
Block deletion of items in the library. This parameter has been deprecated because overriding Purview retention label settings has been deprecated in SharePoint Online. This parameter will be removed in the next major release.
Type: Boolean
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-BlockEdit
Block editing of items in the library. This parameter has been deprecated because overriding Purview retention label settings has been deprecated in SharePoint Online. This parameter will be removed in the next major release.
Type: Boolean
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Connection
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.
Type: PnPConnection
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Label
The name of the retention label
Type: String
Parameter Sets: (All)
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-List
The ID or Url of the list.
Type: ListPipeBind
Parameter Sets: (All)
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-SyncToItems
Apply label to existing items in the library
Type: Boolean
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False