From 67e8c1d3168e8fc13e4ca5d25675b9c259105410 Mon Sep 17 00:00:00 2001 From: Gautam Sheth Date: Sat, 16 Nov 2024 22:33:24 +0200 Subject: [PATCH] Added -CanSyncHubSitePermissions parameter to Set-PnPSite cmdlet to control syncing of hub site permissions. (#4555) Co-authored-by: Gautam Sheth --- CHANGELOG.md | 1 + documentation/Set-PnPSite.md | 15 +++++++++++++++ src/Commands/Site/SetSite.cs | 11 ++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eac38c21..d6b667962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled` to `Set-PnPTenant` which allows for updating of web property bag when DenyAddAndCustomizePages is enabled [#4508](https://github.com/pnp/powershell/pull/4508) - Added `SiteId` to the output of `Get-PnPTenantSite` [#4527](https://github.com/pnp/powershell/pull/4527) - Added `Add-PnPFileSensitivityLabel` which allows for assigning sensitivity labels to SharePoint files [#4538](https://github.com/pnp/powershell/pull/4538) +- Added `-CanSyncHubSitePermissions` parameter to `Set-PnPSite` cmdlet to set value of allowing syncing hub site permissions to this associated site. ### Changed diff --git a/documentation/Set-PnPSite.md b/documentation/Set-PnPSite.md index 250cb8b1a..82f127362 100644 --- a/documentation/Set-PnPSite.md +++ b/documentation/Set-PnPSite.md @@ -48,6 +48,7 @@ Set-PnPSite [-Identity ] [-ExcludedBlockDownloadGroupIds ] [-ListsShowHeaderAndNavigation ] [-RestrictContentOrgWideSearch ] + [-CanSyncHubSitePermissions ] [-Connection ] ``` @@ -629,6 +630,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CanSyncHubSitePermissions +Sets value if syncing hub site permissions to this associated site is allowed. + +```yaml +Type: Switch Parameter +Parameter Sets: Set Properties + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Wait Wait for the operation to complete diff --git a/src/Commands/Site/SetSite.cs b/src/Commands/Site/SetSite.cs index d1efe0f1d..45baae471 100644 --- a/src/Commands/Site/SetSite.cs +++ b/src/Commands/Site/SetSite.cs @@ -130,6 +130,9 @@ public class SetSite : PnPSharePointCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] public bool? HidePeoplePreviewingFiles; + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] + public SwitchParameter? CanSyncHubSitePermissions; + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_LOCKSTATE)] public SwitchParameter Wait; @@ -188,6 +191,12 @@ protected override void ExecuteCmdlet() } } + if (ParameterSpecified(nameof(CanSyncHubSitePermissions)) && CanSyncHubSitePermissions.HasValue) + { + site.CanSyncHubSitePermissions = CanSyncHubSitePermissions.Value; + context.ExecuteQueryRetry(); + } + if (ParameterSpecified(nameof(LogoFilePath))) { if (!System.IO.Path.IsPathRooted(LogoFilePath)) @@ -422,7 +431,7 @@ protected override void ExecuteCmdlet() { siteProperties.HidePeoplePreviewingFiles = HidePeoplePreviewingFiles.Value; executeQueryRequired = true; - } + } if (executeQueryRequired) {