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

Copy of this page option missing in SharePoint

This post describes an observation of how the copy of this page option will be missing for certain pages in SharePoint Online and how to get around it.

Modern pages are great in SharePoint Online…they look good, are easy to author and can be shared really easily once published. However, there are some quirks to the user experience when creating and copying pages, in particular the copy of this page option.

The issue

In the old days of SharePoint 2010, you could only copy or move pages through site content and structure – unless you used PowerShell. Well nowadays it’s as simple as a couple of clicks from the ribbon: 

  • Press + New
  • Select copy of this page
Copy of this page option available in SharePoint Online.

Or at least that’s what I thought! The problem occurs with the default homepages within modern SharePoint sites. When you go to try to make a copy of the homepage you will find the option is not available.

Copy of this page option missing from menu.

Workaround

The way I’ve managed to get around this issue is to make a copy of the homepage in the Site Pages library, then rename it to something more meaningful. To do this:

  • Open the Site Pages library
  • Select the Home.aspx page
  • Press Copy to
  • Leave the copy to location as the Site Pages library > press copy here
  • Press the three dots next to the copied page > rename
  • Give your page a new name > press rename
Copy the homepage, then rename it to something more meaningful.

That’s it, you can now work on a copy of the page in the same way you would using the copy of this page option.


How to open SharePoint pages in maintenance mode

This post demonstrates how to access the web part maintenance page for a classic and modern SharePoint site to delete any problem web parts.

Classic SharePoint

Recently I came across an issue with a SharePoint 2010 publishing site. The site had a page on it that was being edited and after a series of web parts were added, crashed and would no longer load. An additional issue here was that there wasn’t another, recent version of the page to restore to.

So, in the steps below detail how I was able to access the page using web part maintenance mode and delete the problem web part:

  • Navigate to the problem page’s URL
  • At the end of the URL add ?contents=1
  • This will then open the problem page up in web part maintenance mode. From here you are able to close, restore defaults or delete web parts from your page

NOTE: make sure you page is checked out before trying this else you won’t be able to make any changes.

  • Select the web part(s) which you think are causing the issue
  • Now select to either close, reset or delete the web part. I chose delete
  • A warning message will appear > press OK

Modern SharePoint

When writing this post I wondered if this method of accessing web part maintenance mode still worked for modern SharePoint – the answer was no! When you try to open a modern page using ?contents=1 you get this:

Opening modern SharePoint pages in classic maintenance mode won’t work.

However, after reading this handy article from Microsoft about maintenance for client-side web parts in SharePoint Online I just switched my query to ?maintenancemode=true and it worked!

Modern web parts have there own query to append to the page URL to access maintenance mode.

Different to the classic example, modern web parts when in maintenance mode show summary, manifest and data tabs with information about each web part.

If you wish to delete a web part from this view you will need to edit the page and delete it from there, then republish like in the example below:

Deleting web parts in maintenance mode within a modern SharePoint page.

SharePoint URL’s

There are loads of URL’s that either I can never remember or haven’t come across that are listed here. However I wanted to keep a list of them on my site just for reference:

DestinationURL
Site Settings/_layouts/settings.aspx
Site Contents/_layouts/viewlsts.apx
Save Site as a Template/_layouts/savetmpl.aspx
View All People/_layouts/people.aspx?MembershipGroupId=0
View People and Groups/_layouts/groups.aspx
Workflows/_layouts/wrkmng.aspx
Workflow Health/_layouts/15/workflowservicehealth.aspx
Workflow History (Hidden)/lists/Workflow%20History
Create New Site items/_layouts/create.aspx
Manage Site Collection Admin Permissions/_layouts/mngsiteadmin.aspx
View Sites and Workspaces/_layouts/mngsubwebs.aspx
Manage User Permissions/_layouts/user.aspx
Recycle Bin/_layouts/RecycleBin.aspx
Second-Stage Recycle Bin (w/ Admin Permissions)/_layouts/AdminRecycleBin.aspx
Manage Site Content and Structure/_layouts/sitemanager.aspx
Manage Site Content Types/_layouts/mngctype.aspx
Manage Site Columns/_layouts/mngfield.aspx
Quick Launch Settings/_layouts/quiklnch.aspx
Navigation Settings/_layouts/AreaNavigationSettings.aspx
Web Analytics Reports (Site Usage Summary)/_layouts/usage.aspx
Manage Site Collection Features/_layouts/ManageFeatures.aspx?Scope=Site
Manage Site Features/_layouts/ManageFeatures.aspx
Application page for registering SP Apps/_layouts/appregnew.aspx
Sign in as a different user/_layouts/closeConnection.aspx?loginasanotheruser=true
Enable SharePoint Designer/_layouts/SharePointDesignerSettings.aspx
Welcome Page/_layouts/AreaWelcomePage.aspx
Change Site Master Page/_layouts/ChangeSiteMasterPage.aspx
Page Layouts and Site Templates/_Layouts/AreaTemplateSettings.aspx
Force Display the User Profile in the Site Collection/_layouts/userdisp.aspx?id={UserID}&Force=True
Site App Permissions/_layouts/15/appprincipals.aspx?Scope=Web
List Template Gallery/_catalogs/lt
Master Page Gallery/_catalogs/masterpage
Solution Gallery/_catalogs/solutions/
Web Part Gallery/_catalogs/wp
Get SharePoint Server Version/_vti_pvt/Service.cnf
Taxonomy List (Hidden)Lists/TaxonomyHiddenList/AllItems.aspx
Quick Deploy ItemsQuick%20Deploy%20Items/AllItems.aspx
Web Part Maintenance Page?Contents=1
Filter Toolbar (For Lists and Libraries)?Filter=1
Load Ribbon Tab (In a Document Library or List)?InitialTabId=Ribbon.Document
Show Page in a Dialog?isdlg=1
Display List in Grid View (In Document Library or List)?ShowInGrid=True
Open Page in Edit Mode?ToolPaneView=2