This workflow audits your SharePoint Online environment for external sharing risks by identifying files and folders that are shared with anonymous links or external/guest users. It is designed to traverse SharePoint recursively, giving you full visibility into sharing across all sites, document libraries, folders and files.
Scans all SharePoint sites in the tenant.
Traverses SharePoint recursively through every folder and file, starting at the root of each drive.
Fetches permissions for every item (files and folders).
Detects and flags:
Anonymous sharing links (anyone links)
External or guest users, identified by:
#ext#, urn:spo:guest)Outputs only items that are externally shared, including detailed metadata and permission evidence.
In the Set Variables node you define your internal tenantDomains, used to distinguish internal users from external ones.
Microsoft Graph is used to:
Each drive triggers a recursive subworkflow that:
For every discovered item:
A custom filtering step analyzes permissions and:
The final output is a clean, normalized list of externally shared SharePoint items, enriched with:
Create a Microsoft Entra ID (Azure AD) App Registration.
Grant Microsoft Graph – Application permissions:
Sites.Read.AllConfigure an OAuth2 Client Credentials credential in n8n and assign it to all HTTP Request nodes.
Update the Set Variables node:
yourDomain.onmicrosoft.com, yourDomain.com)Run the workflow manually or attach a Schedule Trigger for recurring audits.