How to copy pages between SharePoint sites using Microsoft Lists and Power Automate
Sometimes, you may need to copy a SharePoint page from one site to another. For example, you may want to reuse a page as a template, update a page with new information, or migrate a page to a different site collection. However, there is no out-of-the-box solution to achieve this between sites. You may have to manually recreate the page on the destination site or use a third-party tool or script to copy the page.
Fortunately, you can use the tools you already have in your Microsoft 365 license to create a copy/migration solution for pages using Microsoft Lists and Power Automate. In this blog post, I will show you how to use Microsoft Lists and Power Automate to copy pages between SharePoint sites.
Let’s say you have a SharePoint site for your department, where you create and publish pages with news, announcements, and reports. You have recently reorganized your department structure, and some of these pages belong to another department now. You want to move these pages to the SharePoint site of the new department, where they can be maintained and updated by the relevant people. You may want to delete the original pages on your department site, or keep them as backup in the original site, just in case you need to refer to them later.
To create a copy/migration solution for pages using Microsoft Lists and Power Automate, you need to follow these steps:
- Create a list where you will store the information about the pages being copied, to make it widely accessible to other users who manage your SharePoint tenant I suggest you create the list in the global App Catalog site
- In the Copy Pages list you will need to create the following columns:
- Title (Text) – Created by default, this column will be used to store the URL of the site where the page is located
- Page to Copy (Text) – Library name and name of the page being copied
- Destination Site (Text) – URL where the page will be moved
- Delete Original (Yes/No) – This column will be used to delete or keep the original page on the site
- Open Power Automate and create a new Automated cloud flow
- Give a name to your flow and choose the trigger When an item is created from the SharePoint connector
- Select the site where you created the list and then select the list name
- Click in the New step button and search for the Copy file action on the SharePoint connector
- Fill the action with the values from the list as shown in the following image. To have access to the columns form the Copy list, in the drop down menu click Enter custom value
- Click in the New Step button again and add a Condition control, this is where the original page will be deleted or kept in the original site
- In the If yes branch, add the action delete file from the SharePoint connector and configure it as shown in the following picture
- In the file identifier use the expression below
- Save and test your flow by adding an item to the copy list
Use the list and the flow to copy pages
To copy a page from your source site to your destination site, simply add a new item to your list, just make sure the Page to Copy does not start with a /.
The flow will run automatically every time someone adds an item to the list and will copy the page to the destination site and delete the original one if you have checked that option in the list.
You must check the status of the copied page on the new SharePoint site, any reference to images or documents pointing to the previous site must be changed before publishing it to make sure your users continue to have access to all the information.
If you want to see the process in action have a look to the video below and make sure you subscribe to my YouTube channel to receive more tips and tricks like this one.