🎉 Our Microsoft 365 Reporting & Management Tool is available in Marketplace 🚀
SharePoint Online

How to Get All Expired Sharing Links in SharePoint Online

Expired sharing links in SharePoint Online can weaken security and clutter permissions if left unchecked. Misconfigurations may keep sensitive files exposed, while legitimate users face sudden access issues. This guide explains how to find all expired sharing links so admins can close security gaps and ensure external access ends as intended.

Microsoft 365 tools

Eliminate Security and Access Issues from Expired Sharing Links with Advanced Insights

AdminDroid’s SharePoint Online reporting tool provides Microsoft 365 admins with detailed insights into the expiry status of sharing links, such as links that are expiring soon, set to never expire, and more. These insights enable you to avoid potential security risks caused by expired sharing links across Microsoft 365.

Find Expired Anonymous Sharing Links to Remove Outdated Access

Monitor the expired anonymous sharing links report to confirm that “Anyone” links have properly expired and no longer grant content access for maintaining compliance with privacy policies.

Analyze Sharing Links That Never Expire to Detect Long-Term Access Risks

Identify never-expiring sharing links in SharePoint Online to minimize prolonged data exposure and prevent violation of retention policies.

Monitor Secure Link Events to Ensure Expired Secure Links are Properly Removed

Audit secure link events to verify whether expired secure links were removed or if access was extended with proper authorization in SharePoint Online.

Visualize Expired Link Insights with the Sharing Link Overview Dashboard

Track sharing links overview dashboard to check on link sharing summary along with details on expired links, upcoming expirations, etc., to prevent collaboration issues.

Identify Expired Sharing Links in OneDrive to Streamline Access Management

Monitor expired OneDrive sharing links to maintain controlled content sharing and support compliance requirements in Microsoft 365.

Audit Files and Folder Sharing Links to Ensure Compliance and Data Security

Review all file and folder sharing links to identify those shared with internal users, external users, or groups, and apply expiration on sensitive content to ensure timely access termination.

In summary, AdminDroid’s SharePoint Online management tool provides a detailed view of sharing links and their expiration details across all SharePoint Online sites. It also allows you to manage sharing links, view permission summaries by link type, track access request activities, and more to strengthen Microsoft 365 security.

Explore a full range of reporting options

Important tips

Restrict external site sharing settings by granting only site owners to create, view, or manage sharing links with expiration dates and passwords to ensure strict external access control.

Configure default sharing links in the SharePoint admin center to prevent users from creating ‘Anyone links’ and minimize the risk of oversharing.

Limit external sharing by domain and set link expiration to ensure accountability and maintain well-managed sharing activities.

Common Errors and Resolution Steps

Below are common errors and troubleshooting fixes that may occur while exporting all expired sharing links in SharePoint Online.

Error ./GetAllSharingLinks.ps1: C:\Windows\System32\GetAllSharingLinks.ps1 cannot be loaded. The file C:\Windows\System32\GetAllSharingLinks.ps1 is not digitally signed. You cannot run this script on the current system.

This error occurs because the current execution policy is set to “Restricted”, which blocks the script execution.

Fix To resolve this error, you can set the execution policy as shown below.
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process Error

Error Remove-PnPFileSharingLink: The file /sites/ProjectWorkSpace/https://contoso.sharepoint.com/sites/ProjectSite/Shared Documents/General does not exist.

The error occurs when executing the Remove-PnPFileSharingLink cmdlet with an incorrect value in the -FileUrl parameter.

Fix Ensure that you're using the correct file URL. You can retrieve and verify the URL by executing the following cmdlet after being connected to the PnPOnline PowerShell module.
Get-PnPListItem -List "Shared Documents" | ForEach-Object { $_.FieldValues["FileRef"] }

Error Attempted to perform an unauthorized operation.

This error occurs when the GetAllSharingLink.ps1 script is executed without a certificate thumbprint.

Fix Create a self-signed certificate and replace <thumbprint> with the newly created certificate thumbprint to let the script access all sites, regardless of ownership.
Use the parameter -ExpiredLinks and run the command given below to list all the expired sharing links.
./GetAllSharingLinks.ps1 -CertificateThumbprint "<thumbprint>" -ExpiredLinks

Error Anonymous links are not enabled on your tenant.

This warning appears when you try to set an expiry date for Anyone links using the Set-PnPTenant cmdlet while these links are disabled tenant-wide.

Fix In the SharePoint admin center, go to Policies » Sharing » External Sharing.
Set the slider for SharePoint to ‘Most permissive’ under 'Content can be shared with' to enable Anyone links.

Error Set-PnPTenant: RequireAnonymousLinksExpireInDays must have a value between 1 and 730

This error occurs when you try to set the expiration using Set-PnPTenant with the -RequireAnonymousLinksExpireInDays parameter and the value exceeds the allowed limit.

Fix Set the tenant-level expiration period for ‘Anyone’ links to a value between 1 and 730 days.

Error Sorry, the link has expired.

This error occurs when the user is trying to access an expired sharing link in SPO.

Fix You may consider reaching out to the user who created the sharing link and request them to delete the expired links.Then, ask them to send a new sharing link with an expiration date.
Frequently Asked Questions

Manage Expired Sharing Links in SharePoint Online for Improved Access

Kickstart Your Journey With
AdminDroid

Your Microsoft 365 Companion with Enormous Reporting Capabilities

Download Now
User Help Manuals Compliance Docs Customer Stories