Dec 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.
Thanks!
Dec 11 2017 09:55 AM
Hi Jarrett,
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!
Aug 01 2018 12:52 AM - edited Aug 01 2018 12:56 AM
Hi @Jarrett Haynes, @Mia Lohé Chung
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.
Alex
Dec 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
Cheers!
Prabath
Feb 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.
Oct 08 2019 02:20 PM
The command you shared is to save page and upload it to same site collection under sitepages folder?
Jan 06 2020 06:57 AM
Looks like a proper business process flow
Jun 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.
HTH!
-SCM
Sam Misemer
Jul 09 2020 12:10 PM
@SamMisemer THANK YOU! This was the most amazingly simple solution. Definitely looking forward to using Automate more for tasks like this!
Jul 09 2020 05:07 PM
:) Thank you! I am glad it helped. I went crazy trying to figure out how NOT to recreate the wheel each time I made a new course group/site and tried this and happily found my solution.
There are now scripts to create some template sites, which basically run after the site creation and automate a lot of changes, but they're a lot more technically complicated. This is by far the easiest way I have found to do this. Take a look though at the scripts if you want, it might fit your solution better.
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-overview
Feel free to ping me if you need help in the future!
-SCM
Jan 19 2021 06:48 AM
Oct 08 2022 11:24 AM