12-07-2017 01:50 PM
12-07-2017 01:50 PM
One of the items I've been trying to tackle is how to move a site page between site collections (two different communication sites). In the same Site Pages library, this is simple. The usage case scenario here would be if we have a designated "UAT" environment where users modify their site pages to their exact specifications. Right now the only way I know of is to manually recreate this page in the destination site.
I've been working through the features of the Office DEV PnP PowerShell framework using the ClientSidePage objects, but it doesn't appear through development that this functionality is quite there to read a site page, then add a site page at a new target based on that. Also tried varying other methods of moving files between sites to see if it would 'magically' just work with no luck.
Has anyone ever tried or have come up with a solution similar to that in which I'm seeking?
FYI: Sharegate has been tried and also does not have that capability as they probably base their migrations on what's available to use already.
12-11-2017 09:55 AM
Full disclosure, I work for Sharegate :) The tool should be able to perform your action without any issues. Can you send an email to the support team? They'd love to take a look with you to identify the problem. Good luck!
08-01-2018 12:52 AM - edited 08-01-2018 12:56 AM
did you find a solution for this problem. I face the same issue at the moment. I've tried ShareGate (access denied with global admin, site coll admin, etc.) and looked at PnP and PowerShell, but there doesn't seem to be a way to copy or move a site page from the pages library to another site collection within the same tenant. The source site is a modern page of type communication, the target site is a modern page of type team site.
Thank you for any response.
12-19-2018 03:40 PM
Hi @Alexander Tihme,
PnP worked for me :)
My approach was simple. I downloaded the page as a file to my local machine using;
Get-PnPFile -Url '/sites/intranet/SitePages/myfile.aspx' -Path 'C:\Pages' -Filename 'myfile.aspx' -AsFile
Then upload to the target site using;
Add-PnPFile -Path 'C:\Pages\myfile.aspx' -Folder "SitePages"
You will have to change some Webpart settings after the file is uploaded.
Thanks to PnP Team
02-28-2019 11:19 PM
I am getting this error. Have someone resolved this?
Get-PnPFile : The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord,
and EndProcessing methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly,
or contact Microsoft Customer Support Services.
10-08-2019 02:20 PM
The command you shared is to save page and upload it to same site collection under sitepages folder?
06-25-2020 06:34 AM
I have had success using MS Power Automate (aka Flow).
I apologize if anyone thinks this is "off topic" but you can achieve this very simply using MS Power Automate AKA Flow (tested 6/25/20) and the SharePoint connector and Copy File action.
Create an instant flow, add the manually trigger a flow trigger, and add the SharePoint Copy File action. See the image below, you can choose the exact file you want to copy, and the destination folders in a separate site. I'm creating a more complex flow that uses a "template" site to copy the "template" pages after the fact when I create a new O365 group (and associated site).
My case is an educational environment and letting the content creators (teachers!) be able to make supplemental or main online courses WITHOUT having to be a sharepoint design whiz. I create the O365 group, let the server make the site and team, then run my flow and copy the template pages to the new site, and the teachers can create a new course site based on existing approved branding/structure.
by Mark Kashman on February 22, 2019
by Bob German on September 04, 2018
by Mark Kashman on April 16, 2018