| Method | Bulk removal | Cross-site scope | Link-scope detail | Scripting required |
|---|---|---|---|---|
| Manage Access panel (per file) | No | No, one item at a time | Yes | No |
| PnP PowerShell | Yes, with a written script | Yes | Yes | Yes |
| Shared Links & Permissions (ShareMaster) | Yes | Yes | Yes | No |
Three ways to find out how many shared links exist across a SharePoint tenant and clean up the ones nobody needs anymore: the built-in Manage Access panel, a PnP PowerShell script, and ShareMaster's Shared Links & Permissions tool. Each covers the same ground with a different amount of manual effort.
What is a SharePoint shared link, and why does it need auditing?
A shared link is a URL generated by the Share button on a file or folder that grants access without adding a named person to a site's permission groups. Links can be scoped to "anyone with the link," "people in your organisation," or specific named people, and each scope is progressively less risky. The problem is that links accumulate silently: a link created for a two-week project review often outlives the project by years, and nobody revisits it unless something prompts an audit.
Option 1: Manage Access panel
Every file and folder in SharePoint Online has a Manage Access panel reachable from the item's context menu, showing every shared link currently active on that item along with who created it and its scope. An owner can revoke any link directly from this panel with a couple of clicks.
This works well when you already know which file is a problem. It does not work as an audit method, because there is no tenant-wide or even site-wide view: checking a library of a thousand files means opening a thousand Manage Access panels one at a time. For a single suspicious file flagged by a user, this is the fastest option available. For anything broader, it does not scale.
Option 2: PnP PowerShell
Get-PnPFileSharingLink and the related Get-PnPSharingLinkAccessRequests cmdlets return sharing link data per file or per library, and can be looped across every site collection in a tenant with a script:
Get-PnPListItem -List "Documents" | ForEach-Object { Get-PnPFileSharingLink -Identity $_.FieldValues.FileRef }
Looping this across every library in every site collection is where the real engineering effort goes. The cmdlets return data one item at a time, so a tenant with tens of thousands of files means tens of thousands of individual calls, and throttling becomes a real concern on large tenants. Removal requires a second script using Remove-PnPFileSharingLink, run carefully against exactly the links identified as stale.
PowerShell is free and gives full control over exactly which links get removed and under what criteria. The tradeoff is the same one that applies to most PowerShell-based SharePoint auditing: someone has to write it, test it against a non-production site first, handle authentication and module versions, and maintain it as PnP PowerShell itself evolves.
See the full guide to auditing shared links across a tenant for the query patterns that scale to larger site counts.
Option 3: Shared Links & Permissions (ShareMaster)
ShareMaster's Shared Links & Permissions tool audits shared links and unique permissions across every site an admin has access to in one pass, without a script. It surfaces link scope, creation date, and creator for every link found, and supports bulk removal of shared links matching a filter (for example, every "anyone with the link" scope created before a given date). It also identifies items with broken permission inheritance and can bulk-reset them back to a library's standard permission set.
The tool does not change a tenant's external sharing default or any other tenant-level setting. It works within whatever sharing policy is already configured, auditing and cleaning up the links that exist under that policy today.
Shared links vs unique permissions: key differences
| Shared link | Unique permission (broken inheritance) | |
|---|---|---|
| Created by | Share button on a file or folder | Adding a person or group directly to an item's permissions |
| Visible in default views | No, requires Manage Access panel | No, requires a permissions check per item |
| Typical risk | Anyone-with-the-link access outliving its purpose | An item silently accessible outside its library's normal permission set |
| Cleanup action | Revoke the link | Reset inheritance to match the parent library |
See what Shared Links & Permissions audits and removes
Decision Matrix
| Situation | Recommended method |
|---|---|
| One flagged file, know exactly where it is | Manage Access panel |
| Full control over query logic, in-house scripting resource | PnP PowerShell |
| Recurring scheduled script, comfortable maintaining it | PnP PowerShell |
| Tenant-wide audit with no scripting resource | Shared Links & Permissions |
| Need both shared-link and broken-inheritance cleanup in one pass | Shared Links & Permissions |
Frequently Asked Questions
What is a SharePoint shared link, exactly?
A URL generated when a user shares a file or folder using the Share button, rather than granting access by adding a named person to the site's permission groups. Scope can be anyone with the link, people in the organisation, or specific people.
Does removing a shared link delete the file?
No. It only revokes the access that link grants. The file and any access granted through named permissions or group membership is untouched.
Can I audit shared links without changing my tenant's sharing policy?
Yes. Auditing and removing individual links is a per-item action and does not touch the tenant-wide external sharing default.
Once stale links are cleared, the guide to fixing broken permission inheritance covers the related cleanup of unique permissions left behind by ad hoc sharing.