Stale SharePoint Data Connection Finder
Scheduled flow cross-references flow definitions from Power Automate Management against current SharePoint site/list inventory. Identifies flows that reference deleted, moved, or inaccessible SharePoint resources. Logs broken references to Dataverse and sends an Outlook notification to the flow owner with remediation guidance.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
CF-183 is a scheduled governance flow that audits all Power Automate cloud flows in the environment to identify stale SharePoint data connections — references to SharePoint sites or lists that no longer exist or are inaccessible. It cross-references flow definitions retrieved via the Power Automate Management connector against the current SharePoint site/list inventory, then compiles and emails an admin report of any stale references found.
Use Case
Organizations that rely heavily on SharePoint as a data source for Power Automate flows often accumulate stale connections over time — flows that reference deleted lists, migrated sites, or renamed libraries. These stale connections cause silent failures, confusing error emails, and wasted capacity. This flow provides a weekly automated audit that surfaces these issues proactively, giving admins a clear report to act on before end users are impacted.
Flow Architecture
Recurrence — Weekly Audit
RecurrenceTriggers weekly on Monday at 8:00 AM Eastern.
Initialize Variables (5x parallel)
Initialize variableInitializes five string variables in parallel: varSharePointSiteUrl (from flowlibs_SharePointSiteURL), varAdminEmail (from flowlibs_AdminEmail), varReportSubject (from flowlibs_StaleConnectionReportSubject), varStaleConnections (empty string accumulator), and varEnvironmentName (from flowlibs_PAEnvironmentName).
List Flows In Environment
ListFlowsInEnvironment_V2 (Power Automate Management)Calls ListFlowsInEnvironment_V2 via the Power Automate Management connector, passing varEnvironmentName to retrieve all flows in the target environment.
Get SharePoint Lists
GetTables (SharePoint)Calls GetTables against varSharePointSiteUrl to retrieve the current inventory of all lists and libraries on the target SharePoint site.
Select SP List Names
SelectMaps the SharePoint lists output to a flat array of display names for comparison against flow references.
For Each Flow
Apply to eachFor each flow returned from List Flows In Environment: retrieves the flow definition (GetFlow), composes a stringified version of the definition for text searching, then evaluates whether the flow references SharePoint and whether each reference is still valid.
Check If Flow References SharePoint
If conditionTests whether the stringified flow definition contains 'sharepointonline'.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Target SharePoint site to audit against. |
| flowlibs_AdminEmail | String | admin@your-tenant.onmicrosoft.com | Recipient of the stale connection report email. |
| flowlibs_StaleConnectionReportSubject | String | FlowLibs Alert: Stale SharePoint Data Connections Detected | Email subject line for the stale connection report. |
| flowlibs_PAEnvironmentName | String | <your-tenant-id> | Target Power Automate environment ID (the GUID of the environment to audit). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Power Automate Management | shared_flowmanagement | ListFlowsInEnvironment_V2 GetFlow |
| SharePoint Online | shared_sharepointonline | GetTables |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Changing the Audit Schedule
- Edit the Recurrence_Weekly_Audit trigger. Adjust frequency, interval, weekDays, hours, and minutes to your preferred schedule. The default is weekly on Monday at 8:00 AM ET.
- Targeting Multiple SharePoint Sites
- To audit multiple sites, duplicate the Get_SharePoint_Lists action for each additional site URL, merge the results into a unified list name array, and update the comparison logic in Check_If_SP_Site_Is_Accessible.
- Customizing the Report Format
- Modify the Compose_Stale_Report_HTML action to change the HTML template. The default generates a styled HTML table. You can add columns, change colors, or include direct links to the affected flows in the Power Automate portal.
- Adding Teams Notification
- Add a PostMessageToConversation action (Teams connector) alongside or instead of the email action inside the Condition_Has_Stale_Connections true branch to post the report to a Teams channel.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Stringified flow definition
Converts the flow definition body to a string so it can be searched for connector references.
EXPR.02SharePoint reference check
Used in the 'Check If Flow References SharePoint' condition; true when the flow definition mentions the SharePoint Online connector.
EXPR.03Stale connection accumulator append
Appends an HTML table row to the accumulator variable for each stale reference detected.
EXPR.04Has stale connections check
Used in the 'Has Stale Connections' condition to decide whether to send the report email.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.