Copying a page from one site to another in SharePoint

In this post we look at three different ways you can copy a page from one SharePoint site to another.

Intro

The copy/ move features within SharePoint Online were introduced a few years ago, and although they are pretty good, aren’t without their limitations – something I wrote about in 2021. One such limitation is the inability to be able to copy or move site pages from one SharePoint site to another – a frequent request of users and of the SharePoint community to Microsoft, but so far nothing has been implemented.

I’m going to cover a few ways you can copy a site page from site to site, using a variety of different tools and products along the way.

#1 Create a flow in Power Automate

In this example we can use Power Automate to allow users to select the page they want to copy, input the site URL they want to copy to and let the flow do its magic!

  • Create a new flow in Power Automate > use the instant cloud flow option.
  • Create a for a selected file trigger > enter the site address and library name.

NOTE: In my example, just entering ‘Site Pages’ resulting in my flow not appearing in the Site Pages library. This seems to be an issue with the for a selected file trigger. In order to get it to show up, I had to use the library ID instead of the library name. To get the library ID:

  • Open the library settings > more library settings
  • Copy everything between List=&7B until %7D – this is the library ID
Copy the library ID which is the numbers between &7B and %7D
  • In the for a selected file trigger > add an input
  • Select text as the user input type > update the input name and input value placeholder text. This user input type will be used to allow users to enter the site URL they wish to copy their pages to.
Add a text user input type to allow users to input the destination site URL.
  • Add a get file properties action and configure with the following:
    • Enter the source site address of your site pages library
    • Enter either site pages, or the ID of your site pages library
    • Under ID > select ID from the for a selected file trigger
  • Add a copy file action and configure with the following:
    • Current site address: source site address of your site pages library
    • File to copy: Identifier from get file properties
    • Destination site address: destination site (or whatever you called your user input) from for a selected file
    • Destination folder: /SitePages
    • If another file is already there: copy with a new name (optional)

Three steps – that’s it! Now go ahead and test your flow by selecting a site page and copying it to a different site by running your flow.

#2 Use PnP PowerShell

Another way you are able to do this is with PowerShell, in this case I’ll defer to the brilliant SharePoint diary who has a great write up, including all cmdlets you need to copy a page from site to site, or copy all pages. I’ll include the relevant sample for my blog post, but full credit goes to SharePoint diary:

#Parameters
$SourceSiteURL = "https://crescent.sharepoint.com/sites/marketing"
$DestinationSiteURL = "https://crescent.sharepoint.com/sites/branding"
$PageName =  "About.aspx"
 
#Connect to Source Site
Connect-PnPOnline -Url $SourceSiteURL -Interactive
 
#Export the Source page
$TempFile = [System.IO.Path]::GetTempFileName()
Export-PnPPage -Force -Identity $PageName -Out $TempFile
 
#Import the page to the destination site
Connect-PnPOnline -Url $DestinationSiteURL -Interactive
Invoke-PnPSiteTemplate -Path $TempFile

Click here for the full artcle from SharePoint diary.

#3 Use 3rd party migration tools

The final option we have available to us is to utilize 3rd party migration tools to migrate pages between sites. For this example I’ll be using ShareGate, but there are other migration tools that are able to do the same thing:

  • Open ShareGate desktop > press copy.
  • Select copy content only.
  • Enter the URL of your source site > select the Site Pages library.
  • Do the same for the destination site.
  • Select the page from the source location you wish to copy
  • Under options, make the following configuration changes:
    • Check preserve authors and time stamps
    • Check permissions
    • Uncheck user alerts
    • Check web parts
    • Check version history
    • Uncheck flatten folder hierarchy
    • Check update links
    • Check check in as = published
  • Press start copy. Once completed, you should see two successful migration task items for your copied page:

Now you will find your newly copied page in the destination Site Pages library. In my experience of copying pages using ShareGate, images hosted within a CDN will still be present within your page, as will all the of text, layouts and any formatting. Images that are stored within different sites may error, as will document library/ list web parts that point to different sites also.


Advertisement

Applying site templates in SharePoint Online

This post describes a change to how site designs/ templates are applied to sites in SharePoint Online.

Intro

Microsoft published MC249248 in the Message Center on 7 April 2021 stating the following:

This new SharePoint release of scenario-based site templates will help you expand what’s possible with content, pages, and web parts while helping you quickly get started building your own site. Each template contains pre-populated content and web parts that are fully customizable to meet the needs of your organization. This is rolling out on SharePoint Online and mobile.

This was updated on 23 July 2021 with a new timeline stating that this will be complete for Standard Release in late August 2021. What the message doesn’t detail is how this affects the current process for applying site designs to sites you are creating via the SharePoint admin center.

This change landed in my Standard Release environment around the week commencing 16 August. We first noticed it because we no longer had the ability to apply site designs in the admin center!

Before this change you applied your site designs at the point of site creation:

Before the recent site template change, site designs were applied to SharePoint sites at the point of creation.

Following this change the “choose a design” option is no longer present for team or communication sites through the SharePoint admin center. In order to apply designs you now have to apply a site template within the sites settings after you create it.

How to apply a site template

  • Navigate to the site you wish to apply the template to
  • Press the cog > then select apply a site template

Here you are able to choose from Microsoft pre-built templates, or those you have created and deployed into your SharePoint Online environment (from your organization). The experience is slightly different depending on whether you are using pre-built or your own templates.

Using Microsoft pre-built templates

  • Under From Microsoft > select the template you wish to use > press use template
  • The wizard below will show you a progress bar as the template is applied
When applying a Microsoft template, a progress bar will appear as the template is applied.
  • This wizard will disappear once the progress bar reaches 100% and your template will be applied to your site.
A SharePoint site with a Microsoft template applied.

Using custom site templates from your organization

If like me you had already deployed site designs, these are now shown as site templates available from your organization.

  • Press the cog > then select apply a site template
  • Select From your organization > select the template you wish to use > press use template
  • Once you press use template, an orange message bar will appear letting you know that the site template is being applied.
  • The orange message bar will change to green once the site template has been applied. You have to refresh to see the changes
A SharePoint site with a custom template applied.

Resources