Skip to content

Commit

Permalink
Add ExtendPermissionsToUnprotectedFiles parameter to Set-PnPTenant cm…
Browse files Browse the repository at this point in the history
…dlet (#4602)

Co-authored-by: Gautam Sheth <[email protected]>
  • Loading branch information
gautamdsheth and Gautam Sheth authored Dec 2, 2024
1 parent ac6e2ac commit ef939c1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
15 changes: 15 additions & 0 deletions documentation/Set-PnPTenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ Set-PnPTenant [-SpecialCharactersStateInFileFolderNames <SpecialCharactersState>
[-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled <Boolean>]
[-SelfServiceSiteCreationDisabled <Boolean>]
[-SyncAadB2BManagementPolicy]
[-ExtendPermissionsToUnprotectedFiles <Boolean>]
[-Force] [-Connection <PnPConnection>]
```

Expand Down Expand Up @@ -2860,6 +2861,20 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -ExtendPermissionsToUnprotectedFiles
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)

```yaml
Type: Boolean
Parameter Sets: (All)
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Force
If provided, no confirmation will be requested and the action will be performed

Expand Down
29 changes: 19 additions & 10 deletions src/Commands/Admin/SetTenant.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.Online.SharePoint.TenantManagement;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Administration;
using Microsoft.SharePoint.Client.Sharing;
using PnP.PowerShell.Commands.Base;
using System.Management.Automation;
using System;
using Microsoft.Online.SharePoint.TenantManagement;
using System.Collections.Generic;
using Microsoft.SharePoint.Client.Sharing;
using Microsoft.SharePoint.Client.Administration;
using System.Linq;
using System.Management.Automation;
using InformationBarriersMode = PnP.PowerShell.Commands.Enums.InformationBarriersMode;

namespace PnP.PowerShell.Commands.Admin
Expand Down Expand Up @@ -473,10 +473,10 @@ public class SetTenant : PnPAdminCmdlet

[Parameter(Mandatory = false)]
public Role? CoreDefaultShareLinkRole { private set; get; }

[Parameter(Mandatory = false)]
public SharingCapabilities? OneDriveSharingCapability { private set; get; }

[Parameter(Mandatory = false)]
public string[] GuestSharingGroupAllowListInTenantByPrincipalIdentity { private set; get; }

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

[Parameter(Mandatory = false)]
public SwitchParameter SyncAadB2BManagementPolicy { private set; get; }


[Parameter(Mandatory = false)]
public bool? ExtendPermissionsToUnprotectedFiles { private set; get; }


protected override void ExecuteCmdlet()
{
AdminContext.Load(Tenant);
Expand Down Expand Up @@ -1543,12 +1547,12 @@ protected override void ExecuteCmdlet()
Tenant.CoreDefaultShareLinkRole = CoreDefaultShareLinkRole.Value;
modified = true;
}
if(OneDriveSharingCapability.HasValue)
if (OneDriveSharingCapability.HasValue)
{
Tenant.ODBSharingCapability = OneDriveSharingCapability.Value;
modified = true;
}
if(AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.HasValue)
if (AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.HasValue)
{
Tenant.AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled = AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled.Value;
modified = true;
Expand All @@ -1563,7 +1567,12 @@ protected override void ExecuteCmdlet()
Tenant.SyncAadB2BManagementPolicy();
modified = true;
}
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity !=null)
if (ExtendPermissionsToUnprotectedFiles.HasValue)
{
Tenant.ExtendPermissionsToUnprotectedFiles = ExtendPermissionsToUnprotectedFiles.Value;
modified = true;
}
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity != null)
{
if (GuestSharingGroupAllowListInTenantByPrincipalIdentity.Length > 0)
{
Expand Down

0 comments on commit ef939c1

Please sign in to comment.