Skip to content

Commit

Permalink
Additional settings for SetTenantSite.cs : LoopDefaultSharingLinkRole…
Browse files Browse the repository at this point in the history
…, DefaultShareLinkScope, DefaultShareLinkRole, LoopDefaultSharingLinkScope (#3874)

* New parameters added to Set tenant site

* updae

* Update to add additional properties

* updated files

---------

Co-authored-by: Gautam Sheth <[email protected]>
  • Loading branch information
reshmee011 and gautamdsheth authored Apr 8, 2024
1 parent 24e4546 commit 980ea79
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 2 deletions.
75 changes: 75 additions & 0 deletions documentation/Set-PnPTenantSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Set-PnPTenantSite [-Identity] <String> [-Title <String>] [-LocaleId <UInt32>] [-
[-BlockDownloadPolicy <Boolean>] [-ExcludeBlockDownloadPolicySiteOwners <Boolean>]
[-ExcludedBlockDownloadGroupIds <Guid[]>]
[-ListsShowHeaderAndNavigation <Boolean>]
[-DefaultLinkToExistingAccessReset <SwitchParameter>] [-DefaultShareLinkRole <Role>]
[-DefaultShareLinkScope <SharingScope>] [-LoopDefaultSharingLinkRole <Role>]
[-LoopDefaultSharingLinkScope <SharingScope>]
[-Wait]
[-Connection <PnPConnection>]
```
Expand Down Expand Up @@ -821,6 +824,78 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultLinkToExistingAccessReset
To reset the default link to existing access configuration for a site.

```yaml
Type: SwitchParameter
Parameter Sets: Set Properties
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultShareLinkRole
To set the default share link role. Available values are `None`, `Edit`, `Review`, `RestrictedView` and `View`.

```yaml
Type: Role
Parameter Sets: Set Properties
Accepted values: None, Edit, Review, RestrictedView, View
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultShareLinkScope
To set the default sharing link scope. Available values are `Anyone`, `Organization`, `SpecificPeople`, `Uninitialized`.

```yaml
Type: SharingScope
Parameter Sets: Set Properties
Accepted values: Anyone, Organization, SpecificPeople, Uninitialized
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -LoopDefaultSharingLinkRole
To set the loop default sharing link role. Available values are `None`, `Edit`, `Review`, `RestrictedView` and `View`.

```yaml
Type: Role
Parameter Sets: Set Properties
Accepted values: None, Edit, Review, RestrictedView, View
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -LoopDefaultSharingLinkScope
To set the loop default sharing link scope. Available values are Anyone, Organization, SpecificPeople, Uninitialized.

```yaml
Type: SharingScope
Parameter Sets: Set Properties
Accepted values: Anyone, Organization, SpecificPeople, Uninitialized
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Wait
Wait for the operation to complete

Expand Down
34 changes: 33 additions & 1 deletion src/Commands/Admin/SetTenantSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading;
using PnP.PowerShell.Commands.Base.PipeBinds;
using PnP.PowerShell.Commands.Enums;
using Microsoft.SharePoint.Client.Sharing;

namespace PnP.PowerShell.Commands
{
Expand Down Expand Up @@ -192,6 +193,18 @@ public class SetTenantSite : PnPAdminCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Guid[] RestrictedAccessControlGroups;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Role DefaultShareLinkRole;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public SharingScope DefaultShareLinkScope;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public Role LoopDefaultSharingLinkRole;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public SharingScope LoopDefaultSharingLinkScope;

[Parameter(Mandatory = false)]
public SwitchParameter Wait;

Expand Down Expand Up @@ -319,7 +332,26 @@ private void SetSiteProperties(Func<TenantOperationMessage, bool> timeoutFunctio
props.DefaultLinkToExistingAccessReset = true;
updateRequired = true;
}

if (ParameterSpecified(nameof(LoopDefaultSharingLinkScope)))
{
props.LoopDefaultSharingLinkScope = LoopDefaultSharingLinkScope;
updateRequired = true;
}
if (ParameterSpecified(nameof(LoopDefaultSharingLinkRole)))
{
props.LoopDefaultSharingLinkRole = LoopDefaultSharingLinkRole;
updateRequired = true;
}
if (ParameterSpecified(nameof(DefaultShareLinkScope)))
{
props.DefaultShareLinkScope = DefaultShareLinkScope;
updateRequired = true;
}
if (ParameterSpecified(nameof(DefaultShareLinkRole)))
{
props.DefaultShareLinkRole = DefaultShareLinkRole;
updateRequired = true;
}
if (ParameterSpecified(nameof(AllowDownloadingNonWebViewableFiles)))
{
var value = AllowDownloadingNonWebViewableFiles;
Expand Down
11 changes: 10 additions & 1 deletion src/Commands/Model/SPOSite.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client.Sharing;

namespace PnP.PowerShell.Commands.Model
{
Expand Down Expand Up @@ -76,7 +77,11 @@ public class SPOSite

public bool? RequestFilesLinkEnabled { private set; get; }
public int? RequestFilesLinkExpirationInDays { private set; get; }

public Role LoopDefaultSharingLinkRole { get; set; }
public SharingScope DefaultShareLinkScope { get; set; }
public Role DefaultShareLinkRole { get; set; }
public SharingScope LoopDefaultSharingLinkScope { get; set; }

#endregion


Expand Down Expand Up @@ -148,6 +153,10 @@ public SPOSite(SiteProperties props, bool? disableSharingForNonOwnersStatus)
InformationBarrierSegmentsToRemove = props.IBSegmentsToRemove;
RequestFilesLinkEnabled = props.RequestFilesLinkEnabled;
RequestFilesLinkExpirationInDays = props.RequestFilesLinkExpirationInDays;
LoopDefaultSharingLinkRole = props.LoopDefaultSharingLinkRole;
DefaultShareLinkScope = props.DefaultShareLinkScope;
DefaultShareLinkRole = props.DefaultShareLinkRole;
LoopDefaultSharingLinkScope = props.LoopDefaultSharingLinkScope;
}
}
}

0 comments on commit 980ea79

Please sign in to comment.