Skip to content

Commit c2c1b30

Browse files
Add parameters ExcludeBlockDownloadSharePointGroups and ReadOnlyForBlockDownloadPolicy to Set-PnPSite and Set-PnPTenantSite (#5157)
* Add parameters ExcludeBlockDownloadSharePointGroups and ReadOnlyForBlockDownloadPolicy to Set-PnPSite and Set-PnPTenantSite * Update src/Commands/Site/SetSite.cs Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent d7c462d commit c2c1b30

File tree

4 files changed

+100
-2
lines changed

4 files changed

+100
-2
lines changed

documentation/Set-PnPSite.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Set-PnPSite
4747
[-ScriptSafeDomainName <string>]
4848
[-BlockDownloadPolicy <Boolean>] [-ExcludeBlockDownloadPolicySiteOwners <Boolean>]
4949
[-ExcludedBlockDownloadGroupIds <Guid[]>]
50+
[-ExcludeBlockDownloadSharePointGroups <String[]>]
51+
[-ReadOnlyForBlockDownloadPolicy]
5052
[-ListsShowHeaderAndNavigation <Boolean>]
5153
[-RestrictContentOrgWideSearch <Boolean>]
5254
[-CanSyncHubSitePermissions <SwitchParameter>]
@@ -635,6 +637,34 @@ Accept pipeline input: False
635637
Accept wildcard characters: False
636638
```
637639
640+
### -ExcludeBlockDownloadSharePointGroups
641+
Exempts users from the specified SharePoint groups from the block download policy. Users in these groups can fully download any content for the site.
642+
643+
```yaml
644+
Type: String[]
645+
Parameter Sets: Set Properties
646+
647+
Required: False
648+
Position: Named
649+
Default value: None
650+
Accept pipeline input: False
651+
Accept wildcard characters: False
652+
```
653+
654+
### -ReadOnlyForBlockDownloadPolicy
655+
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.
656+
657+
```yaml
658+
Type: SwitchParameter
659+
Parameter Sets: Set Properties
660+
661+
Required: False
662+
Position: Named
663+
Default value: None
664+
Accept pipeline input: False
665+
Accept wildcard characters: False
666+
```
667+
638668
### -ListsShowHeaderAndNavigation
639669
Set a property on a site collection to make all lists always load with the site elements intact.
640670

documentation/Set-PnPTenantSite.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Set-PnPTenantSite [-Identity] <String> [-Title <String>] [-LocaleId <UInt32>] [-
3636
[-MediaTranscription <MediaTranscriptionPolicyType>]
3737
[-BlockDownloadPolicy <Boolean>] [-ExcludeBlockDownloadPolicySiteOwners <Boolean>]
3838
[-ExcludedBlockDownloadGroupIds <Guid[]>]
39+
[-ExcludeBlockDownloadSharePointGroups <String[]>]
40+
[-ReadOnlyForBlockDownloadPolicy]
3941
[-ListsShowHeaderAndNavigation <Boolean>]
4042
[-DefaultLinkToExistingAccessReset <SwitchParameter>] [-DefaultShareLinkRole <Role>]
4143
[-DefaultShareLinkScope <SharingScope>] [-LoopDefaultSharingLinkRole <Role>]
@@ -744,6 +746,34 @@ Accept pipeline input: False
744746
Accept wildcard characters: False
745747
```
746748

749+
### -ExcludeBlockDownloadSharePointGroups
750+
Exempts users from the specified SharePoint groups from the block download policy. Users in these groups can fully download any content for the site.
751+
752+
```yaml
753+
Type: String[]
754+
Parameter Sets: Set Properties
755+
756+
Required: False
757+
Position: Named
758+
Default value: None
759+
Accept pipeline input: False
760+
Accept wildcard characters: False
761+
```
762+
763+
### -ReadOnlyForBlockDownloadPolicy
764+
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.
765+
766+
```yaml
767+
Type: SwitchParameter
768+
Parameter Sets: Set Properties
769+
770+
Required: False
771+
Position: Named
772+
Default value: None
773+
Accept pipeline input: False
774+
Accept wildcard characters: False
775+
```
776+
747777
### -ListsShowHeaderAndNavigation
748778
Set a property on a site collection to make all lists always load with the site elements intact.
749779

src/Commands/Admin/SetTenantSite.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,13 @@ public class SetTenantSite : PnPSharePointOnlineAdminCmdlet
225225

226226
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
227227
public bool AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled;
228-
228+
229+
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
230+
public string[] ExcludeBlockDownloadSharePointGroups;
231+
232+
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
233+
public SwitchParameter ReadOnlyForBlockDownloadPolicy;
234+
229235
[Parameter(Mandatory = false)]
230236
public SwitchParameter Wait;
231237

@@ -677,6 +683,18 @@ private void SetSiteProperties(Func<TenantOperationMessage, bool> timeoutFunctio
677683
updateRequired = true;
678684
}
679685

686+
if (ParameterSpecified(nameof(ExcludeBlockDownloadSharePointGroups)) && ExcludeBlockDownloadSharePointGroups.Length > 0)
687+
{
688+
props.ExcludeBlockDownloadSharePointGroups = ExcludeBlockDownloadSharePointGroups;
689+
updateRequired = true;
690+
}
691+
692+
if (ParameterSpecified(nameof(ReadOnlyForBlockDownloadPolicy)) && ReadOnlyForBlockDownloadPolicy.IsPresent)
693+
{
694+
props.ReadOnlyForBlockDownloadPolicy = ReadOnlyForBlockDownloadPolicy.ToBool();
695+
updateRequired = true;
696+
}
697+
680698
if (updateRequired)
681699
{
682700
var op = props.Update();

src/Commands/Site/SetSite.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ public class SetSite : PnPSharePointCmdlet
134134
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
135135
public SwitchParameter? CanSyncHubSitePermissions;
136136

137+
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
138+
public string[] ExcludeBlockDownloadSharePointGroups;
139+
140+
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
141+
public SwitchParameter ReadOnlyForBlockDownloadPolicy;
142+
137143
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_LOCKSTATE)]
138144
public SwitchParameter Wait;
139145

@@ -440,6 +446,18 @@ protected override void ExecuteCmdlet()
440446
executeQueryRequired = true;
441447
}
442448

449+
if (ParameterSpecified(nameof(ExcludeBlockDownloadSharePointGroups)) && ExcludeBlockDownloadSharePointGroups.Length > 0)
450+
{
451+
siteProperties.ExcludeBlockDownloadSharePointGroups = ExcludeBlockDownloadSharePointGroups;
452+
executeQueryRequired = true;
453+
}
454+
455+
if (ParameterSpecified(nameof(ReadOnlyForBlockDownloadPolicy)) && ReadOnlyForBlockDownloadPolicy.IsPresent)
456+
{
457+
siteProperties.ReadOnlyForBlockDownloadPolicy = ReadOnlyForBlockDownloadPolicy.ToBool();
458+
executeQueryRequired = true;
459+
}
460+
443461
if (executeQueryRequired)
444462
{
445463
siteProperties.Update();
@@ -497,6 +515,8 @@ private bool IsTenantProperty() =>
497515
ParameterSpecified(nameof(ExcludedBlockDownloadGroupIds)) ||
498516
ListsShowHeaderAndNavigation.HasValue ||
499517
HidePeoplePreviewingFiles.HasValue ||
500-
HidePeopleWhoHaveListsOpen.HasValue;
518+
HidePeopleWhoHaveListsOpen.HasValue ||
519+
ParameterSpecified(nameof(ExcludeBlockDownloadSharePointGroups)) ||
520+
ReadOnlyForBlockDownloadPolicy.IsPresent;
501521
}
502522
}

0 commit comments

Comments
 (0)