Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions documentation/Set-PnPSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Set-PnPSite
[-HidePeoplePreviewingFiles <Boolean>]
[-HidePeopleWhoHaveListsOpen <Boolean>]
[-RestrictedAccessControl <Boolean>]
[-OverrideTenantOrganizationSharingLinkExpirationPolicy <Boolean>]
[-OrganizationSharingLinkRecommendedExpirationInDays <int>]
[-OrganizationSharingLinkMaxExpirationInDays <int>]
[-Connection <PnPConnection>]
```

Expand Down Expand Up @@ -961,6 +964,58 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -OverrideTenantOrganizationSharingLinkExpirationPolicy
Allows to set organization sharing link expiration policy for this SharePoint site, which will override the tenant-level policy when set to true. When this is set to true, you can configure the organization sharing link expiration policy for this site collection using the OrganizationSharingLinkRecommendedExpirationInDays and OrganizationSharingLinkMaxExpirationInDays parameters.

```yaml
Type: Boolean
Parameter Sets: Set Properties

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -OrganizationSharingLinkRecommendedExpirationInDays
This parameter specifies the recommended number of days before organization sharing links expire in the SharePoint site. Users can still choose a different expiration period if permitted by policy, but this value is presented as the recommended default.

The valid values :

- Can be from 7 to 730 days and must be less than or equal to the maximum expiration value set by OrganizationSharingLinkMaxExpirationInDays.
- When set to 0 (default), the default value will be OrganizationSharingLinkMaxExpirationInDays.

```yaml
Type: Int32
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -OrganizationSharingLinkMaxExpirationInDays
This parameter specifies the maximum number of days that organization sharing links can remain active before they expire for the SharePoint site.

The valid values :

- can be from 7 to 730 days.
- `0` (default) - No maximum expiration limit is enforced.

```yaml
Type: Int32
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Wait
Wait for the operation to complete

Expand Down
79 changes: 0 additions & 79 deletions documentation/Set-PnPTenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,7 @@ Set-PnPTenant [-SpecialCharactersStateInFileFolderNames <SpecialCharactersState>
[-RestrictResourceAccountAccess <Boolean>]
[-EnforceRequestDigest <Boolean>]
[-RestrictExternalSharingForAgents <Boolean>]
[-AllowFileArchive <Boolean>]
[-AllowFileArchiveOnNewSitesByDefault <Boolean>]
[-DelayContentSecurityPolicyEnforcement <Boolean>]
[-EnforceRequestDigest <Boolean>]
[-EnableNotificationsSubscriptions <Boolean>]
[-Force] [-Connection <PnPConnection>]
```
Expand Down Expand Up @@ -3455,25 +3452,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -EnforceRequestDigest
This parameter controls whether SharePoint enforces request digest validation for client requests.

The valid values are:

- False - a valid request digest is not required on SOAP API calls that perform a state-changing operation.
- True - A valid request digest is required on SOAP API calls that perform a state-changing operation.

```yaml
Type: Boolean
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -RestrictExternalSharingForAgents
This parameter controls whether external sharing is restricted for agents.

Expand All @@ -3493,63 +3471,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -AllowFileArchive
Controls whether file-level archiving is allowed at the tenant level. This setting can be overridden for specific sites by the site-level flag of the same name and has no effect unless Microsoft 365 Archive is enabled for your organization.

The valid values are:

- False (default) - Blocks manual archiving for all files, regardless of the site-level setting. Admin-defined policies can still archive files automatically.
- True - Allows users to manually archive files on sites where file-level archiving is also enabled. Manual archiving is limited to internal users with write access to the file.

```yaml
Type: Boolean
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AllowFileArchiveOnNewSitesByDefault
This parameter controls whether file archiving is enabled by default.

The valid values are:

- False (default) - File archiving is not enabled by default.
- True - File archiving is enabled by default where supported.

```yaml
Type: Boolean
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -EnableNotificationsSubscriptions
This is an opt-in setting that enables or disables writing SharePoint News and Announcement notification data to a list (NewsNotificationList) in the My Site of every user. When enabled, SharePoint Online emits notification events to this list. Third-party solutions must create and manage webhook solutions to receive change notifications and then read the list to process new entries for triggering their own notifications for the user.

The valid values are:

- False (default) - Disables writing SharePoint News and Announcement notification data to a list (NewsNotificationList) in the My Site of every user.
- True - Enables or disables writing SharePoint News and Announcement notification data to a list (NewsNotificationList) in the My Site of every user.

```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
55 changes: 55 additions & 0 deletions documentation/Set-PnPTenantSite.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Set-PnPTenantSite [-Identity] <String> [-Title <String>] [-LocaleId <UInt32>] [-
[-MajorWithMinorVersionsLimit <Int32>] [-FileTypesForVersionExpiration <String[]>]
[-RemoveVersionExpirationFileTypeOverride <String[]>] [-ApplyToNewDocumentLibraries] [-ApplyToExistingDocumentLibraries] [-Force]
[-AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabled <Boolean>] [-IsAuthoritative <Boolean>] [-RestrictedContentDiscoveryForCopilotAndAgents <Boolean>]
[-OverrideTenantOrganizationSharingLinkExpirationPolicy <Boolean>]
[-OrganizationSharingLinkRecommendedExpirationInDays <int>]
[-OrganizationSharingLinkMaxExpirationInDays <int>]
[-ClearGroupId]
[-Wait]
[-Connection <PnPConnection>]
Expand Down Expand Up @@ -1284,6 +1287,58 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -OverrideTenantOrganizationSharingLinkExpirationPolicy
Allows to set organization sharing link expiration policy for this SharePoint site, which will override the tenant-level policy when set to true. When this is set to true, you can configure the organization sharing link expiration policy for this site collection using the OrganizationSharingLinkRecommendedExpirationInDays and OrganizationSharingLinkMaxExpirationInDays parameters.

```yaml
Type: Boolean
Parameter Sets: Set Properties

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -OrganizationSharingLinkRecommendedExpirationInDays
This parameter specifies the recommended number of days before organization sharing links expire in the SharePoint site. Users can still choose a different expiration period if permitted by policy, but this value is presented as the recommended default.

The valid values :

- Can be from 7 to 730 days and must be less than or equal to the maximum expiration value set by OrganizationSharingLinkMaxExpirationInDays.
- When set to 0 (default), the default value will be OrganizationSharingLinkMaxExpirationInDays.

```yaml
Type: Int32
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -OrganizationSharingLinkMaxExpirationInDays
This parameter specifies the maximum number of days that organization sharing links can remain active before they expire for the SharePoint site.

The valid values :

- can be from 7 to 730 days.
- `0` (default) - No maximum expiration limit is enforced.

```yaml
Type: Int32
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Wait
Wait for the operation to complete

Expand Down
46 changes: 46 additions & 0 deletions src/Commands/Admin/SetTenantSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ public class SetTenantSite : PnPSharePointOnlineAdminCmdlet
[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public SwitchParameter ClearGroupId;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public bool? OverrideTenantOrganizationSharingLinkExpirationPolicy;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public int? OrganizationSharingLinkRecommendedExpirationInDays;

[Parameter(Mandatory = false, ParameterSetName = ParameterSet_PROPERTIES)]
public int? OrganizationSharingLinkMaxExpirationInDays;

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

Expand Down Expand Up @@ -775,6 +784,39 @@ private void SetSiteProperties(Func<TenantOperationMessage, bool> timeoutFunctio
updateRequired = true;
}

if (ParameterSpecified(nameof(OverrideTenantOrganizationSharingLinkExpirationPolicy)) && OverrideTenantOrganizationSharingLinkExpirationPolicy.HasValue)
{
props.OverrideTenantOrganizationLinkExpirationPolicy = (bool)OverrideTenantOrganizationSharingLinkExpirationPolicy;
updateRequired = true;
}

if (ParameterSpecified(nameof(OrganizationSharingLinkRecommendedExpirationInDays)) && OrganizationSharingLinkRecommendedExpirationInDays.HasValue)
{
if (!IsValidOrganizationSharingLinkExpirationInDays(OrganizationSharingLinkRecommendedExpirationInDays.Value))
{
throw new PSArgumentException("CoreOrganizationSharingLinkMaxExpirationInDays must have a value of 0 or between 7 and 730", nameof(OrganizationSharingLinkRecommendedExpirationInDays));
}

var organizationLinkMaxExpirationInDays = OrganizationSharingLinkMaxExpirationInDays ?? props.OrganizationLinkMaxExpirationInDays;
if (OrganizationSharingLinkRecommendedExpirationInDays.Value > organizationLinkMaxExpirationInDays)
{
throw new PSArgumentException("OrganizationSharingLinkRecommendedExpirationInDays must be less than or equal to OrganizationSharingLinkMaxExpirationInDays", nameof(OrganizationSharingLinkRecommendedExpirationInDays));
}

props.OrganizationLinkRecommendedExpirationInDays = (int)OrganizationSharingLinkRecommendedExpirationInDays;
updateRequired = true;
}

if (ParameterSpecified(nameof(OrganizationSharingLinkMaxExpirationInDays)) && OrganizationSharingLinkMaxExpirationInDays.HasValue)
{
if (!IsValidOrganizationSharingLinkExpirationInDays(OrganizationSharingLinkMaxExpirationInDays.Value))
{
throw new PSArgumentException("OrganizationLinkMaxExpirationInDays must have a value of 0 or between 7 and 730", nameof(OrganizationSharingLinkMaxExpirationInDays));
}
props.OrganizationLinkMaxExpirationInDays = (int)OrganizationSharingLinkMaxExpirationInDays;
updateRequired = true;
}

if (SiteVersionPolicyUtilities.ApplyToSiteProperties(props, GetSiteVersionPolicyOptions(), Identity.Url, prompt => Force || ShouldContinue(prompt, string.Empty)))
{
updateRequired = true;
Expand Down Expand Up @@ -928,5 +970,9 @@ private bool IsRootSite(string url)
}
return false;
}
private static bool IsValidOrganizationSharingLinkExpirationInDays(int value)
{
return value == 0 || value >= 7 && value <= 730;
}
}
}
7 changes: 6 additions & 1 deletion src/Commands/Model/SPOSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public class SPOSite
public bool HidePeoplePreviewingFiles { get; set; }
public bool HidePeopleWhoHaveListsOpen { get; set; }
public SPOFileVersionFileTypePolicySettings[] VersionPolicyFileTypeOverride { get; set; }

public int OrganizationSharingLinkRecommendedExpirationInDays { get; set; }
public int OrganizationSharingLinkMaxExpirationInDays { get; set; }
public bool OverrideTenantOrganizationSharingLinkExpirationPolicy { get; set; }
#endregion


Expand Down Expand Up @@ -212,6 +214,9 @@ public SPOSite(SiteProperties props, bool? disableSharingForNonOwnersStatus)
HidePeoplePreviewingFiles = props.HidePeoplePreviewingFiles;
HidePeopleWhoHaveListsOpen = props.HidePeopleWhoHaveListsOpen;
VersionPolicyFileTypeOverride = props.VersionPolicyFileTypeOverride;
OverrideTenantOrganizationSharingLinkExpirationPolicy = props.OverrideTenantOrganizationLinkExpirationPolicy;
OrganizationSharingLinkRecommendedExpirationInDays = props.OrganizationLinkRecommendedExpirationInDays;
OrganizationSharingLinkMaxExpirationInDays = props.OrganizationLinkMaxExpirationInDays;
}
}
}
Loading
Loading