Skip to content
28 changes: 28 additions & 0 deletions documentation/Set-PnPPage.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@ Set-PnPPage -Identity "MyPage" -ShowPublishDate $true -Publish
```
Display the date when the page was published in the header section of the page

### EXAMPLE 12
```powershell
Set-PnPPage -Identity "MyPage.aspx" -Like
```
Likes the page

### EXAMPLE 11
```powershell
Set-PnPPage -Identity "MyPage.aspx" -Like:$false
```
Unlikes the page

## PARAMETERS

### -CommentsEnabled
Expand Down Expand Up @@ -363,6 +375,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Like
Likes the page, if parameter is set to false then it Unlikes the page

```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```



## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
16 changes: 16 additions & 0 deletions src/Commands/Pages/SetPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public class SetPage : PnPWebCmdlet, IDynamicParameters
[Parameter(Mandatory = false)]
public bool ShowPublishDate;

[Parameter(Mandatory = false)]
public SwitchParameter Like = false;


private CustomHeaderDynamicParameters customHeaderParameters;

public object GetDynamicParameters()
Expand Down Expand Up @@ -174,6 +178,18 @@ protected override void ExecuteCmdlet()
}
}

if (ParameterSpecified(nameof(Like)))
{
if (Like)
{
clientSidePage.Like();
}
else
{
clientSidePage.Unlike();
}
}

if (ContentType != null)
{
string ctId = ContentType.GetIdOrWarn(this, CurrentWeb);
Expand Down