| 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 (ShareMaster) | Yes, filtered by scope, type or expiry (paid licence) | Yes, the sites you choose | Yes, scope, type and expiry | 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 tools. 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 (ShareMaster)
ShareMaster's Shared Links tools audit shared links and unique permissions in the document libraries you pick, across the sites you choose, without a script. Report shared links downloads an Excel report with each link's URL, scope, type and expiry, and Report unique permissions lists every item whose permissions no longer inherit, with the people and groups granted directly on it. Link creators and creation dates are not in the report; for the who and when, search the Microsoft Purview audit log. Reporting is free on the Community licence.
With a paid licence (Recycle Master or Clone Master), Remove shared links revokes the links in the chosen libraries after you review every one it found, and can narrow the run to one link scope, one link type or only expired links. Remove a person from sharing links takes one person off Specific People links and leaves the links in place. Remove unique permissions resets broken-inheritance items to inherited, saving each item's permissions to a log first.
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 |
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 |
| Site-by-site audit with no scripting resource | ShareMaster Shared Links |
| Need both shared-link and broken-inheritance cleanup in one tool | ShareMaster Shared Links |
| Remove only one link type, or only expired links, without a script | ShareMaster, with its link type and expiry filters |
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.
Last updated