Set-PnPLabel

Tip

We encourage you to make improvements to this documentation. Please navigate to https://github.com/pnp/powershell/blob/dev/documentation/Set-PnPLabel.md to change this file.

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>]
   [<CommonParameters>]

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.

EXAMPLE 3

Set-PnPLabel -List "Demo List" -Label "Project Documentation" -BlockDelete $true -BlockEdit $true

This sets an O365 label on the specified list or library. Next, it also blocks the ability to either edit or delete the item.

Parameters

-BlockDeletion

Block deletion of items in the library

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-BlockEdit

Block editing of items in the library

Type:Boolean
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
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Label

The name of the retention label

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-List

The ID or Url of the list.

Type:ListPipeBind
Position:0
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-SyncToItems

Apply label to existing items in the library

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False