Forum Discussion
Jarrett Haynes
Dec 07, 2017Copper Contributor
Copy Site Pages (ClientSidePage) Site to Site
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!
- SamMisemerCopper Contributor
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
- Ruth ShyerCopper ContributorSamMisemer THANK YOU! I've been searching for an alternative to PowerShell. This solution is Perfect!
- IanCaldwellIron Contributorsam - perfect, much easier than powershell.
- vlukeCopper Contributor
SamMisemer THANK YOU! This was the most amazingly simple solution. Definitely looking forward to using Automate more for tasks like this!
- SamMisemerCopper Contributor
🙂 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
- Alexander TihmeBrass Contributor
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
- Prabath FonsekaCopper Contributor
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
- JoostvdLindenBrass Contributor
Looks like a proper business process flow
- Mia Lohé ChungCopper Contributor
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!