diff --git a/documentation/Set-PnPTenantSite.md b/documentation/Set-PnPTenantSite.md index ff9df2d55..e57fd96a6 100644 --- a/documentation/Set-PnPTenantSite.md +++ b/documentation/Set-PnPTenantSite.md @@ -37,6 +37,9 @@ Set-PnPTenantSite [-Identity] [-Title ] [-LocaleId ] [- [-BlockDownloadPolicy ] [-ExcludeBlockDownloadPolicySiteOwners ] [-ExcludedBlockDownloadGroupIds ] [-ListsShowHeaderAndNavigation ] + [-DefaultLinkToExistingAccessReset ] [-DefaultShareLinkRole ] + [-DefaultShareLinkScope ] [-LoopDefaultSharingLinkRole ] + [-LoopDefaultSharingLinkScope ] [-Wait] [-Connection ] ``` @@ -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 diff --git a/src/Commands/Admin/SetTenantSite.cs b/src/Commands/Admin/SetTenantSite.cs index 70ed371e7..0a59ded10 100644 --- a/src/Commands/Admin/SetTenantSite.cs +++ b/src/Commands/Admin/SetTenantSite.cs @@ -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 { @@ -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; @@ -319,7 +332,26 @@ private void SetSiteProperties(Func 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; diff --git a/src/Commands/Model/SPOSite.cs b/src/Commands/Model/SPOSite.cs index e0fdcc15c..dcfe41284 100644 --- a/src/Commands/Model/SPOSite.cs +++ b/src/Commands/Model/SPOSite.cs @@ -1,5 +1,6 @@ using System; using Microsoft.Online.SharePoint.TenantAdministration; +using Microsoft.SharePoint.Client.Sharing; namespace PnP.PowerShell.Commands.Model { @@ -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 @@ -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; } } } \ No newline at end of file