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.
Overview
Watches a configured SharePoint document library, reads the new file's properties when an item is created, and posts a notification to a Teams channel. Minimal, reliable SharePoint→Teams alert pattern.
**Flow ID:** ef716cf9-172b-f111-8341-6045bd0052fe • **State:** Off
Use Case
Teams collaborate on documents in SharePoint but live in Teams. Email subscriptions are noisy. This flow keeps the team in the loop where they already work.
**Key Benefits:** real-time visibility; all values configurable via env vars; minimal action count; Teams PostMessage richer than email.
Flow Architecture
Trigger: **When a file is created in a folder - FlowLibs File Alerts** (SharePoint OnNewFile). 1. Init 4 vars (site URL, library, Teams channel + group) 2. **Get file properties** (SharePoint GetFileItem) — pulls full metadata 3. **Post message in a chat or channel** (Teams) — formatted message announcing new file with link + author *Note: SharePoint is currently a direct connection — promote to connection ref before production.*
Environment Variables
| Variable | Schema Name | Type | Default | Purpose |
|---|---|---|---|---|
| SharePoint Site URL | flowlibs_SharePointSiteURL | String | (none) | Absolute URL of the source SharePoint site |
| File Alerts Library Name | flowlibs_FileAlertsLibraryName | String | (none) | Display name of the library to watch |
| Teams Group ID | flowlibs_TeamsGroupId | String | (none) | M365 Group / Team GUID |
| Teams Channel ID | flowlibs_TeamsChannelId | String | (none) | Channel within the team |
Connectors & Connections
| Connector | API Name | Connection Format | Usage |
|---|---|---|---|
| SharePoint | shared_sharepointonline | Direct connection (not promoted to ref) | OnNewFile trigger + GetFileItem |
| Microsoft Teams | shared_teams | flowlibs_sharedteams_8ba46 | PostMessageToChannel — new-file notification |
Customization Guide
1. Import; set 4 env vars; promote SharePoint to connection ref; update Teams ref; turn on.
**Common Modifications:** filter by file type via Condition with endsWith(); switch to adaptive cards; email fallback via Outlook; group multiple files into Recurrence digest; audit logging via Create item; promote message template to env var.
Key Expressions
- @parameters('flowlibs_SharePointSiteURL') — site URL
- @outputs('Get_file_properties_-_Get_New_File_Details')?['body/{FilenameWithExtension}'] — file name
- @outputs('Get_file_properties_-_Get_New_File_Details')?['body/{Link}'] — file link