From c85f9073cde5865f1a54304df97ec5833b94d2a8 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 4 Nov 2024 12:30:51 +0100 Subject: [PATCH 1/2] Adding AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled --- CHANGELOG.md | 1 + documentation/Set-PnPTenant.md | 15 +++++++++++++++ src/Commands/Admin/SetTenant.cs | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4526cb4a5..40f300d6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `Restore-PnPFlow` cmdlet which allows for undeleting a flow within 21 days of deletion. [#4415](https://github.com/pnp/powershell/pull/4415) - Added `-ExcludeDeprecated` to `Export-PnpTaxonomy` which allows for deprecated terms to be excluded from the export [#4053](https://github.com/pnp/powershell/pull/4053) - Added `-HidePeoplePreviewingFiles` to `Set-PnPSite` which allows for hiding the people previewing files feature on a site [#4416](https://github.com/pnp/powershell/pull/4416) +- Added `-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled` to `Set-PnPTenant` which allows for updating of web property bag when DenyAddAndCustomizePages is enabled ### Changed diff --git a/documentation/Set-PnPTenant.md b/documentation/Set-PnPTenant.md index 399ce7c63..1d7735fb5 100644 --- a/documentation/Set-PnPTenant.md +++ b/documentation/Set-PnPTenant.md @@ -160,6 +160,7 @@ Set-PnPTenant [-SpecialCharactersStateInFileFolderNames [-GuestSharingGroupAllowListInTenantByPrincipalIdentity ] [-OneDriveSharingCapability ] [-DelayDenyAddAndCustomizePagesEnforcement ] + [-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled ] [-Force] [-Connection ] ``` @@ -242,6 +243,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled +Enables or disables web property bag update when DenyAddAndCustomizePages is enabled. When AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled is set to $true, web property bag can be updated even if DenyAddAndCustomizePages is turned on when the user had AddAndCustomizePages (prior to DenyAddAndCustomizePages removing it). + +```yaml +Type: Boolean +Parameter Sets: (All) + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ApplyAppEnforcedRestrictionsToAdHocRecipients When the feature is enabled, all guest users are subject to conditional access policy. By default guest users who are accessing SharePoint Online files with pass code are exempt from the conditional access policy. diff --git a/src/Commands/Admin/SetTenant.cs b/src/Commands/Admin/SetTenant.cs index 2bf51e519..20e65dd96 100644 --- a/src/Commands/Admin/SetTenant.cs +++ b/src/Commands/Admin/SetTenant.cs @@ -480,6 +480,9 @@ public class SetTenant : PnPAdminCmdlet [Parameter(Mandatory = false)] public string[] GuestSharingGroupAllowListInTenantByPrincipalIdentity { private set; get; } + [Parameter(Mandatory = false)] + public bool? AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled { private set; get; } + protected override void ExecuteCmdlet() { AdminContext.Load(Tenant); @@ -1539,6 +1542,11 @@ protected override void ExecuteCmdlet() Tenant.ODBSharingCapability = OneDriveSharingCapability.Value; modified = true; } + if(AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.HasValue) + { + Tenant.AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled = AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.Value; + modified = true; + } if (GuestSharingGroupAllowListInTenantByPrincipalIdentity !=null) { if (GuestSharingGroupAllowListInTenantByPrincipalIdentity.Length > 0) From 5889523cb6a4587bf74da94781c128d8561e0126 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Mon, 4 Nov 2024 12:34:29 +0100 Subject: [PATCH 2/2] Adding to retrieval of current properties --- src/Commands/Model/SPOTenant.cs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/Commands/Model/SPOTenant.cs b/src/Commands/Model/SPOTenant.cs index 0bac35231..c5e5c3b7e 100644 --- a/src/Commands/Model/SPOTenant.cs +++ b/src/Commands/Model/SPOTenant.cs @@ -250,6 +250,7 @@ public class SPOTenant public bool? SharePointAddInsDisabled { private set; get; } public SharingCapabilities? OneDriveSharingCapability { private set; get; } public string[] GuestSharingGroupAllowListInTenantByPrincipalIdentity { private set; get; } + public bool? AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled { private set; get; } #endregion public SPOTenant(Tenant tenant, ClientContext clientContext) @@ -739,26 +740,8 @@ public SPOTenant(Tenant tenant, ClientContext clientContext) { } - try - { - AppBypassInformationBarriers = tenant.AppBypassInformationBarriers; - } - catch - { - } - - try - { - if (tenant.DefaultODBMode != null) - { - DefaultOneDriveInformationBarrierMode = Enum.Parse(tenant.DefaultODBMode); - } - } - catch - { - } - - + try { AppBypassInformationBarriers = tenant.AppBypassInformationBarriers; } catch { } + try { if (tenant.DefaultODBMode != null) DefaultOneDriveInformationBarrierMode = Enum.Parse(tenant.DefaultODBMode); } catch { } try { CoreSharingCapability = tenant.CoreSharingCapability; } catch { } try { EnableVersionExpirationSetting = tenant.EnableVersionExpirationSetting; } catch { } try { BlockUserInfoVisibilityInOneDrive = tenant.BlockUserInfoVisibilityInOneDrive; } catch { } @@ -789,6 +772,7 @@ public SPOTenant(Tenant tenant, ClientContext clientContext) try { SharePointAddInsDisabled = tenant.SharePointAddInsDisabled; } catch { } try { OneDriveSharingCapability = tenant.ODBSharingCapability; } catch { } try { GuestSharingGroupAllowListInTenantByPrincipalIdentity = tenant.GuestSharingGroupAllowListInTenantByPrincipalIdentity?.ToArray(); } catch { } + try { AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled = tenant.AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled; } catch { } } } }