Templates / Clean up stale Entra B2B guest accounts with Microsoft Graph, Teams, and SharePoint

Clean up stale Entra B2B guest accounts with Microsoft Graph, Teams, and SharePoint

Ready for 3.0

by Mychel Garzon ✓ · 25 views · created 2026-06-04 · Engineering

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 24 nodes and runs on a schedule (cron 0 8 * * 1). Along the way it connects Microsoft Teams.

How it runs

Trigger: On a schedule (cron 0 8 * * 1).

  1. Set Config Parameters (Edit Fields (Set)): sets 8 fields: sharepointSiteId, sharepointListId, teamsTeamId…
  2. Initialize Pagination Loop (Code): runs custom JavaScript code
  3. Fetch Guest Page via URL (HTTP Request): calls an HTTP API
  4. Accumulate Guests from Page (Code): runs custom JavaScript code
  5. If: checks a condition and branches into true / false
  6. Set Next URL (Edit Fields (Set)): sets 1 field: nextUrl
  7. Filter Stale Guest Accounts (Code): runs custom JavaScript code
  8. Check Stale Guests Presence (If): checks a condition and branches into true / false
  9. Unpack Stale Guests Array (Code): runs custom JavaScript code
  10. Notify No Stale Guests (Microsoft Teams): work with channel message

…plus 11 more steps. See the full node list below.

Services it uses

Microsoft Teams

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (10)

From the author

Quick overview This workflow runs weekly to find inactive Entra ID (Azure AD) B2B guest accounts using Microsoft Graph sign-in activity, notifies each guest’s sponsor via Microsoft Teams, waits 72 hours, deletes the accounts, and logs successful deletions to…

Excerpt from Mychel Garzon's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.