Copying a Sharepoint Page To Another Site

  • Post by Mike Dixson
  • Jul 18, 2023
post-thumb

After much trawling of the Internet I found an interesting take on the pain of moving a Sharepoint page from one site to another, using Power Automate.

The solution that RobElliot had posted contained a few manual steps, and knowing colleagues and I had all done this more than once I refined his solution a bit.

Starting with a PowerApps V2 component enables us to capture input from the user for the soure page and destination site. Screenshot of the Power Automate Flow

The slice expressions were created by Power Automate from examples and work for our site(s) so I’ll include them in order below. However if you find these don’t work in your Sharepoint update them using the expression from examples feature in Power Automate.

Site Address

slice(triggerBody()[’text’], 0, add(nthIndexOf(triggerBody()[’text’], ‘/’, sub(sub(length(triggerBody()[’text’]), length(replace(triggerBody()[’text’], ‘/’, ‘’))), 1)), 1))

File Path

slice(triggerBody()[’text’], add(nthIndexOf(triggerBody()[’text’], ‘/’, sub(sub(length(triggerBody()[’text’]), length(replace(triggerBody()[’text’], ‘/’, ‘’))), 1)), 1))

Current Site Address

slice(triggerBody()[’text’], 0, add(nthIndexOf(triggerBody()[’text’], ‘/’, sub(sub(length(triggerBody()[’text’]), length(replace(triggerBody()[’text’], ‘/’, ‘’))), 1)), 1))

When you run the flow you’ll be prompted for the page url which should look like this https://yousite.sharepoint.com/sites/OriginalSiteName/SitePages/Employee-Onboard-Processes.aspx and the destination site to copy the page too https://yoursite.sharepoint.com/sites/NewStarters..

Note this flow doesn’t remove the original page. You can either manually delete the original page or if you like you can add that to the flow.

Image fromMoving Vectors by Vecteezy