File Alert Demo
Demo flow that monitors a SharePoint document library for new or modified files matching a filter and posts an adaptive card alert to a Teams channel with file metadata and a direct link.
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
This demo flow watches a configured SharePoint document library, reads the new file's properties when an item is created, and posts a notification to a Microsoft Teams channel so the relevant team sees new uploads in near-real-time. It's a minimal, reliable "SharePoint → Teams" alert pattern — the simplest building block for a fan-out alerts library.
Use Case
Teams that collaborate on documents in SharePoint typically don't camp on the library — they live in Teams. Email subscriptions are noisy and easily ignored. This flow keeps the team in the loop where they already work: a clean Teams channel post every time someone drops a file in a watched library, complete with the file's metadata.
The flow is ideal for teams that:
- Real-time visibility — files in the library show up in Teams within seconds.
- Site URL, library name, channel, and group all configurable via env vars.
- Minimal action count keeps run-time costs low.
- Works as a teaching pattern for the wider FlowLibs alerts collection.
Flow Architecture
When a file is created in a folder
SharePoint OnNewFileFires whenever a new file lands in the configured library/folder.
Init 4 variables
InitializeVariablevarSharePointSiteURL, varLibraryName, varTeamsChannelId, varTeamsGroupId — all from env vars.
Get New File Details
SharePoint GetFileItemPulls full metadata for the trigger file (display name, modified by, link).
Notify Team of New File
Teams PostMessageToChannelPosts a formatted message to channel varTeamsChannelId inside team varTeamsGroupId announcing the new file with link + author.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | — | Absolute URL of the source SharePoint site. |
| flowlibs_FileAlertsLibraryName | String | — | Display name of the library to watch (also used by the SharePoint trigger binding). |
| flowlibs_TeamsGroupId | String | — | Microsoft 365 Group / Team GUID. |
| flowlibs_TeamsChannelId | String | — | Channel within the team that should receive the post. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| SharePoint | shared_sharepointonline | OnNewFile (trigger) GetFileItem |
| Teams | shared_teams | PostMessageToChannel |
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.
- Promote SharePoint to a connection reference
- Add a SharePoint connection reference to the solution and re-bind the trigger + Get file properties — required for clean ALM.
- Filter by file type or naming pattern
- Add a Condition after Get file properties that gates the Teams post on endsWith(triggerOutputs()?['body/{Name}'], '.pdf') or a regex on the filename.
- Switch to adaptive cards
- Replace Post message in a chat or channel with Post adaptive card in a chat or channel for richer formatting (thumbnail, 'Open file' button).
- Email fallback
- Add an Office 365 Outlook Send Email (V2) after the Teams post to also notify a distribution list.
- Group multiple files into a digest
- Replace the SharePoint trigger with Recurrence + Get files (properties only) filtered by Modified ge addDays(utcNow(), -1) and post a daily digest.
- Promote the message template to an env var
- Move the Teams card body into a string env var so wording can change without flow edits.
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.01SharePoint site URL (trigger / Get file properties input)
Standard pattern for env-var binding.
EXPR.02Library name input
Used by both the trigger binding and Get file properties.
EXPR.03File name for the Teams post
Reads the FilenameWithExtension column from Get file properties.
EXPR.04File link for the Teams post
Reads the Link column from Get file properties.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.