diff --git a/documentation/Set-PnPSite.md b/documentation/Set-PnPSite.md index 6c7040c83..18ea63fa4 100644 --- a/documentation/Set-PnPSite.md +++ b/documentation/Set-PnPSite.md @@ -47,6 +47,8 @@ Set-PnPSite [-ScriptSafeDomainName ] [-BlockDownloadPolicy ] [-ExcludeBlockDownloadPolicySiteOwners ] [-ExcludedBlockDownloadGroupIds ] + [-ExcludeBlockDownloadSharePointGroups ] + [-ReadOnlyForBlockDownloadPolicy] [-ListsShowHeaderAndNavigation ] [-RestrictContentOrgWideSearch ] [-CanSyncHubSitePermissions ] @@ -635,6 +637,34 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ExcludeBlockDownloadSharePointGroups +Exempts users from the specified SharePoint groups from the block download policy. Users in these groups can fully download any content for the site. + +```yaml +Type: String[] +Parameter Sets: Set Properties + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReadOnlyForBlockDownloadPolicy +When enabled in combination with BlockDownloadPolicy, users will only be able to view the content in read-only mode but will not be able to download or sync files. + +```yaml +Type: SwitchParameter +Parameter Sets: Set Properties + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ListsShowHeaderAndNavigation Set a property on a site collection to make all lists always load with the site elements intact. diff --git a/documentation/Set-PnPTenantSite.md b/documentation/Set-PnPTenantSite.md index 19d7c52cd..9e19373ec 100644 --- a/documentation/Set-PnPTenantSite.md +++ b/documentation/Set-PnPTenantSite.md @@ -36,6 +36,8 @@ Set-PnPTenantSite [-Identity] [-Title ] [-LocaleId ] [- [-MediaTranscription ] [-BlockDownloadPolicy ] [-ExcludeBlockDownloadPolicySiteOwners ] [-ExcludedBlockDownloadGroupIds ] + [-ExcludeBlockDownloadSharePointGroups ] + [-ReadOnlyForBlockDownloadPolicy] [-ListsShowHeaderAndNavigation ] [-DefaultLinkToExistingAccessReset ] [-DefaultShareLinkRole ] [-DefaultShareLinkScope ] [-LoopDefaultSharingLinkRole ] @@ -744,6 +746,34 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ExcludeBlockDownloadSharePointGroups +Exempts users from the specified SharePoint groups from the block download policy. Users in these groups can fully download any content for the site. + +```yaml +Type: String[] +Parameter Sets: Set Properties + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReadOnlyForBlockDownloadPolicy +When enabled in combination with BlockDownloadPolicy, users will only be able to view the content in read-only mode but will not be able to download or sync files. + +```yaml +Type: SwitchParameter +Parameter Sets: Set Properties + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ListsShowHeaderAndNavigation Set a property on a site collection to make all lists always load with the site elements intact. diff --git a/src/Commands/Admin/SetTenantSite.cs b/src/Commands/Admin/SetTenantSite.cs index e7c2852bb..ac5f8136e 100644 --- a/src/Commands/Admin/SetTenantSite.cs +++ b/src/Commands/Admin/SetTenantSite.cs @@ -225,7 +225,13 @@ public class SetTenantSite : PnPSharePointOnlineAdminCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] public bool AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled; - + + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] + public string[] ExcludeBlockDownloadSharePointGroups; + + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] + public SwitchParameter ReadOnlyForBlockDownloadPolicy; + [Parameter(Mandatory = false)] public SwitchParameter Wait; @@ -677,6 +683,18 @@ private void SetSiteProperties(Func timeoutFunctio updateRequired = true; } + if (ParameterSpecified(nameof(ExcludeBlockDownloadSharePointGroups)) && ExcludeBlockDownloadSharePointGroups.Length > 0) + { + props.ExcludeBlockDownloadSharePointGroups = ExcludeBlockDownloadSharePointGroups; + updateRequired = true; + } + + if (ParameterSpecified(nameof(ReadOnlyForBlockDownloadPolicy)) && ReadOnlyForBlockDownloadPolicy.IsPresent) + { + props.ReadOnlyForBlockDownloadPolicy = ReadOnlyForBlockDownloadPolicy.ToBool(); + updateRequired = true; + } + if (updateRequired) { var op = props.Update(); diff --git a/src/Commands/Site/SetSite.cs b/src/Commands/Site/SetSite.cs index f85c9c178..31aedd2fa 100644 --- a/src/Commands/Site/SetSite.cs +++ b/src/Commands/Site/SetSite.cs @@ -134,6 +134,12 @@ public class SetSite : PnPSharePointCmdlet [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] public SwitchParameter? CanSyncHubSitePermissions; + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] + public string[] ExcludeBlockDownloadSharePointGroups; + + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)] + public SwitchParameter ReadOnlyForBlockDownloadPolicy; + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_LOCKSTATE)] public SwitchParameter Wait; @@ -440,6 +446,18 @@ protected override void ExecuteCmdlet() executeQueryRequired = true; } + if (ParameterSpecified(nameof(ExcludeBlockDownloadSharePointGroups)) && ExcludeBlockDownloadSharePointGroups.Length > 0) + { + siteProperties.ExcludeBlockDownloadSharePointGroups = ExcludeBlockDownloadSharePointGroups; + executeQueryRequired = true; + } + + if (ParameterSpecified(nameof(ReadOnlyForBlockDownloadPolicy)) && ReadOnlyForBlockDownloadPolicy.IsPresent) + { + siteProperties.ReadOnlyForBlockDownloadPolicy = ReadOnlyForBlockDownloadPolicy.ToBool(); + executeQueryRequired = true; + } + if (executeQueryRequired) { siteProperties.Update(); @@ -497,6 +515,8 @@ private bool IsTenantProperty() => ParameterSpecified(nameof(ExcludedBlockDownloadGroupIds)) || ListsShowHeaderAndNavigation.HasValue || HidePeoplePreviewingFiles.HasValue || - HidePeopleWhoHaveListsOpen.HasValue; + HidePeopleWhoHaveListsOpen.HasValue || + ParameterSpecified(nameof(ExcludeBlockDownloadSharePointGroups)) || + ReadOnlyForBlockDownloadPolicy.IsPresent; } }