Copying SharePoint Online Pages Between Sites with Power Automate (List-Driven “Sync Pages” Pattern)

This article shows a repeatable, list-driven way to copy pages from one SharePoint Online site to another using Power Automate.

The key idea is simple:

  • You maintain a SharePoint list (your “control table”) with Source Site, Target Site, and a Sync command.
  • A user selects a row and clicks Sync (or sets a Status to “Requested”).
  • A flow runs, enumerates pages from the Site Pages library in the source, and recreates/copies them into the target.

To cover real-world needs (publishing, subfolders, throttling, logging), the pattern uses standard SharePoint connector actions plus Send an HTTP request to SharePoint when the connector actions don’t go far enough. (Microsoft Learn)


1) What this pattern is (and what it isn’t)

What it does well

  • Copies .aspx pages stored in Site Pages (modern or classic pages are still stored as files in that library).
  • Can copy:
    • All pages
    • Only pages modified after a date
    • Pages inside folders (optionally)
  • Can enforce a consistent destination structure and optionally run a “post-copy publish” step.

What it doesn’t fully replicate (by design)

  • Full “site template” recreation.
  • Page analytics, likes, some page-level history/versions (unless you implement version copy explicitly—Power Automate alone usually won’t preserve version history).

2) Prerequisites

Permissions

The connection account used by Power Automate must have:

  • Read access to the source site’s Site Pages library
  • Contribute/Edit access to the target site’s Site Pages library
  • If you publish/approve: the rights required to publish pages in the target.

Connector and REST basics

  • You’ll use the SharePoint connector actions (Get item, Update item, Get files, Create file).
  • For advanced operations, you’ll use Send an HTTP request to SharePoint, which lets you call SharePoint REST endpoints directly. (Microsoft Learn)

3) Build the “Sites to Sync” control list

Create a SharePoint list (example name: SiteSyncRequests). Keep it simple and explicit.

Recommended columns

Core routing

  • Title (Single line text): Friendly name (optional)
  • SourceSiteUrl (Single line text): e.g., https://contoso.sharepoint.com/sites/SourceSite
  • TargetSiteUrl (Single line text): e.g., https://contoso.sharepoint.com/sites/TargetSite

Sync command

  • SyncPages (Yes/No) or Status (Choice: Draft, Requested, Running, Completed, Failed)
  • SyncScope (Choice): AllPages, ModifiedSinceDate
  • ModifiedSince (DateTime, optional)

Operational flags (optional but useful)

  • IncludeSubfolders (Yes/No)
  • OverwriteExisting (Yes/No)
  • PublishAfterCopy (Yes/No)
  • SetHomePage (Yes/No)
  • HomePageFileName (Single line text, e.g., Home.aspx)

Logging

  • LastRun (DateTime)
  • LastResult (Multiple lines text)
  • CopiedCount (Number)
  • FailedCount (Number)

4) Flow overview (high-level)

Trigger

  • “When an item is created or modified” (SharePoint) pointing to your control list. (Microsoft Learn)

Gating

  • Trigger conditions so the flow fires only when a row is actually requesting sync (avoids wasted runs and API calls). (Microsoft Learn)

Execution

  1. Read the request row (source/target URLs, flags).
  2. List pages from the source Site Pages library.
  3. For each page:
    • Download content
    • Create/overwrite the file in the target Site Pages library
    • (Optional) check in / publish
  4. Update the request row with results.

5) Step-by-step: build the Flow

Step 1 — Trigger: “When an item is created or modified”

  • Site Address: your “automation” site (where the list lives)
  • List Name: SiteSyncRequests

Add trigger conditions (recommended)
Trigger conditions reduce unnecessary runs, and Microsoft documents this pattern for Power Automate triggers. (Microsoft Learn)

Example trigger condition if you use Status:

@equals(triggerBody()?['Status']?['Value'], 'Requested')

Example trigger condition if you use SyncPages boolean:

@equals(triggerBody()?['SyncPages'], true)

Step 2 — Mark as Running (so users see progress)

Add Update item:

  • Status = Running
  • LastRun = utcNow()
  • LastResult = “Starting…”

Step 3 — Validate inputs (fail fast)

Add a few Condition checks:

  • SourceSiteUrl is not empty
  • TargetSiteUrl is not empty
  • If ModifiedSinceDate scope is selected, ensure ModifiedSince has a value

If validation fails:

  • Update item -> Status = Failed, LastResult = reason
  • Terminate

6) Listing pages from “Site Pages” in the source

You have two mainstream approaches:

Option A (easy): “Get files (properties only)”

Use Get files (properties only) against the Site Pages library.

Important notes:

  • The action supports limiting to a folder and optionally including nested items (subfolders). (Microsoft Learn)
  • In some tenants, very large libraries can hit action limits; keep filters tight where possible.

Configuration hints:

  • Library Name: Site Pages
  • Include Nested Items: (use your IncludeSubfolders flag)
  • Filter Query: File_x0020_Type eq 'aspx' (if available in your environment)

If your connector UI won’t allow dynamic site URLs easily, or you need more control, use Option B.


Option B (most flexible): “Send an HTTP request to SharePoint” (REST)

Microsoft explicitly positions Send an HTTP request to SharePoint as the tool for calling SharePoint REST when built-in actions don’t cover your needs. (Microsoft Learn)

Use this endpoint pattern to enumerate files in a folder:

  • GET _api/web/GetFolderByServerRelativeUrl('SitePages')/Files

This REST approach is documented in Microsoft Learn’s guidance for working with folders/files via REST. (Microsoft Learn)

Filtering (ModifiedSince)
SharePoint REST supports rich OData querying overall. (Microsoft Learn)
Practically, many teams do filtering in-flow:

  • Get the file list
  • Filter array where TimeLastModified >= ModifiedSince

(That avoids spending time fighting REST filter nuances per environment.)


7) Copying each page (the reliable “download + create” pattern)

Inside an Apply to each over the page list:

Step 7.1 — Get file content from source

Use either:

  • Get file content (SharePoint connector), or
  • REST: GET _api/web/GetFileByServerRelativeUrl('...')/$value

The REST “get file by server relative url / $value” approach is part of the standard REST file operations guidance. (Microsoft Learn)

Step 7.2 — Create file in target Site Pages

Use Create file (target site, Site Pages library):

  • File Name: same as source (or rename)
  • File Content: output from “Get file content”

If OverwriteExisting is enabled:

  • Use “Create file” with overwrite support if available in your action version, OR
  • Check if file exists first and then delete/replace (implementation depends on your connector capabilities)

Step 7.3 — (Optional) Check-in / Publish

Some environments require pages to be checked in or published to be visible as expected.

You can do this via REST endpoints on the file resource. Microsoft Learn documents the check-in endpoint shape (resource method style). (Microsoft Learn)

Typical pattern (conceptually):

  • Check in the file (major check-in if you want publish-ready state)
  • Publish/approve depending on your library settings

Tip: If your target “Site Pages” library uses content approval, you may need an approval status step as well (SharePoint connector has related actions). (Microsoft Learn)


8) Setting the Home Page (optional)

If your request row says SetHomePage = Yes, and a HomePageFileName is provided, you can update the target site’s welcome page after the copy completes.

Implementation options:

  • Use “Send an HTTP request to SharePoint” to update the target web’s welcome page property (site-specific; test in a dev site first).
  • Or leave homepage selection out of the first version and keep the flow focused on copying pages reliably.

(Homepage automation is very doable, but it’s the first place teams hit “it worked in one site but not another” differences.)


9) Reliability: retries, concurrency, and throttling

Power Automate runs can fail mid-loop if:

  • You copy too many pages at once
  • The destination site is heavily used
  • Connector calls get throttled

Recommended controls:

  • Turn on Concurrency Control on the Apply to each and set it to 1 initially.
  • Add Delay (e.g., 200–500 ms) between page copies if you see throttling.
  • Log failures per file and continue (don’t fail the entire run on one bad page).

10) Logging and user experience

At the end:

  • Update the control list row:
    • Status = Completed / Failed
    • CopiedCount / FailedCount
    • LastResult = summary

A simple and effective “operator view” is:

  • Users never open Flow runs.
  • They only watch the Status and LastResult fields in the list.

11) Common gotchas (and how to avoid them)

  1. Copy looks successful, but page doesn’t render right
    This often happens when a page depends on web parts/apps not present in the target. The file is copied, but components are missing.
  2. Large Site Pages library scanning is slow
    Use:
  • ModifiedSince scope
  • Folder scoping (Limit Entries to Folder)
  • Filter arrays early
    Microsoft’s “Get files” guidance explains scoping and nested items behavior. (Microsoft Learn)
  1. Need REST for “missing actions”
    Microsoft explicitly calls out “Send an HTTP request to SharePoint” for cases where the connector isn’t enough. (Microsoft Learn)

Final implementation checklist (table)

StepFlow ComponentAction / SettingKey InputsOutput / Result
1TriggerWhen an item is created or modifiedControl list itemStarts flow on request (Microsoft Learn)
2GuardrailTrigger conditionsStatus = Requested (or SyncPages = true)Avoids unnecessary runs (Microsoft Learn)
3ProgressUpdate itemStatus = RunningUser sees it started
4ValidateConditionsURLs, flags, optional dateFail fast with clear error
5Enumerate pagesGet files (properties only) or Send HTTP RequestSite Pages, optional nested itemsReturns list of .aspx pages (Microsoft Learn)
6Copy loopApply to eachPage listIterates each page
7DownloadGet file content or REST $valueSource page pathFile content stream (Microsoft Learn)
8UploadCreate fileTarget Site PagesPage created (optionally overwritten)
9Finalize(Optional) Check-in / PublishREST methods / connector actionsPage visible & published (Microsoft Learn)
10Wrap upUpdate itemStatus, counts, summaryOperators get results in the list

Edvaldo Guimrães Filho Avatar

Published by