diff --git a/documentation/Set-PnPPage.md b/documentation/Set-PnPPage.md index 046434d9b..1d189cd53 100644 --- a/documentation/Set-PnPPage.md +++ b/documentation/Set-PnPPage.md @@ -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 @@ -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) \ No newline at end of file diff --git a/src/Commands/Pages/SetPage.cs b/src/Commands/Pages/SetPage.cs index 5eee83bff..4aa368965 100644 --- a/src/Commands/Pages/SetPage.cs +++ b/src/Commands/Pages/SetPage.cs @@ -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() @@ -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);