Skip to content

Commit ef939c1

Browse files
gautamdshethGautam Sheth
andauthored
Add ExtendPermissionsToUnprotectedFiles parameter to Set-PnPTenant cmdlet (#4602)
Co-authored-by: Gautam Sheth <gautam.sheth@staffbase.com>
1 parent ac6e2ac commit ef939c1

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

documentation/Set-PnPTenant.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Set-PnPTenant [-SpecialCharactersStateInFileFolderNames <SpecialCharactersState>
163163
[-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled <Boolean>]
164164
[-SelfServiceSiteCreationDisabled <Boolean>]
165165
[-SyncAadB2BManagementPolicy]
166+
[-ExtendPermissionsToUnprotectedFiles <Boolean>]
166167
[-Force] [-Connection <PnPConnection>]
167168
```
168169

@@ -2860,6 +2861,20 @@ Accept pipeline input: False
28602861
Accept wildcard characters: False
28612862
```
28622863

2864+
### -ExtendPermissionsToUnprotectedFiles
2865+
This property can be used to turn on/off the capability called "Extended SharePoint permissions to unprotected files". To learn more about this feature check [here](https://learn.microsoft.com/en-us/purview/sensitivity-labels-sharepoint-extend-permissions)
2866+
2867+
```yaml
2868+
Type: Boolean
2869+
Parameter Sets: (All)
2870+
2871+
Required: False
2872+
Position: Named
2873+
Default value: None
2874+
Accept pipeline input: False
2875+
Accept wildcard characters: False
2876+
```
2877+
28632878
### -Force
28642879
If provided, no confirmation will be requested and the action will be performed
28652880

src/Commands/Admin/SetTenant.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using Microsoft.Online.SharePoint.TenantAdministration;
2+
using Microsoft.Online.SharePoint.TenantManagement;
23
using Microsoft.SharePoint.Client;
4+
using Microsoft.SharePoint.Client.Administration;
5+
using Microsoft.SharePoint.Client.Sharing;
36
using PnP.PowerShell.Commands.Base;
4-
using System.Management.Automation;
57
using System;
6-
using Microsoft.Online.SharePoint.TenantManagement;
78
using System.Collections.Generic;
8-
using Microsoft.SharePoint.Client.Sharing;
9-
using Microsoft.SharePoint.Client.Administration;
109
using System.Linq;
10+
using System.Management.Automation;
1111
using InformationBarriersMode = PnP.PowerShell.Commands.Enums.InformationBarriersMode;
1212

1313
namespace PnP.PowerShell.Commands.Admin
@@ -473,10 +473,10 @@ public class SetTenant : PnPAdminCmdlet
473473

474474
[Parameter(Mandatory = false)]
475475
public Role? CoreDefaultShareLinkRole { private set; get; }
476-
476+
477477
[Parameter(Mandatory = false)]
478478
public SharingCapabilities? OneDriveSharingCapability { private set; get; }
479-
479+
480480
[Parameter(Mandatory = false)]
481481
public string[] GuestSharingGroupAllowListInTenantByPrincipalIdentity { private set; get; }
482482

@@ -488,7 +488,11 @@ public class SetTenant : PnPAdminCmdlet
488488

489489
[Parameter(Mandatory = false)]
490490
public SwitchParameter SyncAadB2BManagementPolicy { private set; get; }
491-
491+
492+
[Parameter(Mandatory = false)]
493+
public bool? ExtendPermissionsToUnprotectedFiles { private set; get; }
494+
495+
492496
protected override void ExecuteCmdlet()
493497
{
494498
AdminContext.Load(Tenant);
@@ -1543,12 +1547,12 @@ protected override void ExecuteCmdlet()
15431547
Tenant.CoreDefaultShareLinkRole = CoreDefaultShareLinkRole.Value;
15441548
modified = true;
15451549
}
1546-
if(OneDriveSharingCapability.HasValue)
1550+
if (OneDriveSharingCapability.HasValue)
15471551
{
15481552
Tenant.ODBSharingCapability = OneDriveSharingCapability.Value;
15491553
modified = true;
15501554
}
1551-
if(AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.HasValue)
1555+
if (AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.HasValue)
15521556
{
15531557
Tenant.AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled = AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.Value;
15541558
modified = true;
@@ -1563,7 +1567,12 @@ protected override void ExecuteCmdlet()
15631567
Tenant.SyncAadB2BManagementPolicy();
15641568
modified = true;
15651569
}
1566-
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity !=null)
1570+
if (ExtendPermissionsToUnprotectedFiles.HasValue)
1571+
{
1572+
Tenant.ExtendPermissionsToUnprotectedFiles = ExtendPermissionsToUnprotectedFiles.Value;
1573+
modified = true;
1574+
}
1575+
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity != null)
15671576
{
15681577
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity.Length > 0)
15691578
{

0 commit comments

Comments
 (0)