How can I configure SharePoint sharing link expiration settings with PowerShell?

0
0
Asked By MellowCedar42 On

I want to configure tenant-wide SharePoint and OneDrive sharing link retention settings, such as setting the maximum organization sharing link expiration to 365 days, along with the recommended expiration values. Should I use the SharePoint Online PowerShell module or PnP PowerShell for this? Is the SharePoint Online module still supported, and is it expected to be removed? I can connect successfully with PnP PowerShell, but running Set-PnPTenant -CoreOrganizationSharingLinkMaxExpirationInDays 365 returns an error saying that no matching parameter exists. Are Get-SPOTenant and Get-PnPTenant showing the same tenant settings?

2 Answers

Answered By QuietOrbit7 On

The PnP documentation lists these tenant parameters, so the first things to check are that PnP PowerShell is installed or updated correctly and that the connection is being made from an elevated PowerShell session. If the command still fails, include the complete error and the installed PnP PowerShell version, since parameter support can vary between releases.

MellowCedar42 -

The connection succeeds through Connect-PnPOnline, but Set-PnPTenant reports that it cannot find the CoreOrganizationSharingLinkMaxExpirationInDays parameter.

Answered By SilverMaple18 On

This appears to have been a missing-parameter issue in the PnP implementation rather than a problem with the tenant setting itself. Support for these parameters was added in newer nightly builds, so updating to a build that includes the fix should allow Set-PnPTenant to accept them. The expiration values should be chosen according to your organization’s security and sharing policies; there is no universal number that fits every environment.

AmberVale63 -

The example values were based on an internal company decision, not a generally recommended standard. It is best to have the business and security teams agree on the appropriate duration.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.