CloudSharePoint & Cloud BridgingAutomated

Document Sync Demo

Demo flow that watches a source SharePoint document library and replicates new and modified files to a destination location (OneDrive folder or another SharePoint library), preserving metadata and handling conflict cases.

Members OnlySign in or create a free account to download this solution.

Overview

Watches a configured SharePoint document library and replicates new files to a OneDrive for Business folder, preserving folder structure and enforcing a maximum file size. On success it sends a confirmation email; on size overrun it sends a too-large notice; any unexpected error drops into a Scope-level error handler that emails the operator.

**Flow ID:** 541c9567-852b-f111-8341-6045bd0052fe • **State:** Off (demo)

Use Case

Teams often need a copy of SharePoint library content mirrored into OneDrive for offline editing, sharing with external partners, or for an Office app that integrates more cleanly with OneDrive. This flow automates the copy, fails loudly via email, and keeps an audit trail in Sent Items.

**Key Benefits:** real-time replication; configurable size guard; error-handling Scope; success/too-large/failure notifications; all values driven by env vars.

Flow Architecture

Trigger: **When a File Is Created in Document Library** (SharePoint).

1. Initialize 6 variables (site URL, library, OneDrive folder, notify email, max file size MB)
2. **Check File Size Within Limit** (If)
   - True: Get File Content → Build OneDrive Path → Create File in OneDrive → Send Success Email
   - False: Send File Too Large Email
3. **Error Handling Scope** (runs on failure of #2): Send Sync Failure Email

Environment Variables

VariableSchema NameTypeDefaultPurpose
SharePoint Site URLflowlibs_SharePointSiteURLString(none)Absolute URL of the source SharePoint site
SharePoint Doc Sync Library IDflowlibs_SharePointDocSyncLibraryIDString(none)GUID of the source document library to watch
OneDrive Sync Folder Pathflowlibs_OneDriveSyncFolderPathString(none)Destination folder path in the connection owner's OneDrive

Connectors & Connections

ConnectorAPI NameConnection FormatUsage
SharePointshared_sharepointonlineflowlibs_sharedsharepointonline_bedb3Trigger OnNewFile + GetFileContent
OneDrive for Businessshared_onedriveforbusinessnew_sharedonedriveforbusiness_53153CreateFile — write mirrored file
Office 365 Outlookshared_office365new_sharedoffice365_ac201SendEmailV2 — success/too-large/failure notifications

Customization Guide

1. Import solution; set the 3 env vars; update SharePoint, OneDrive, Outlook connection refs.
2. Edit varNotificationEmail and varMaxFileSizeMB literals.
3. Turn on.

**Common Modifications:** mirror to SharePoint instead of OneDrive; promote notification email to env var; add modified-file branch; add file-extension deny-list; replace email with Teams adaptive cards; add concurrency throttling.

Key Expressions

- @parameters('flowlibs_SharePointSiteURL') — read site URL
- @lessOrEquals(div(triggerOutputs()?['body/Length'], 1048576), variables('varMaxFileSizeMB')) — size check
- @concat(variables('varOneDriveSyncFolder'), '/', triggerOutputs()?['body/{FilenameWithExtension}']) — destination path