Home

Copy Site Pages (ClientSidePage) Site to Site

%3CLINGO-SUB%20id%3D%22lingo-sub-135209%22%20slang%3D%22en-US%22%3ECopy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-135209%22%20slang%3D%22en-US%22%3E%3CP%3EOne%20of%20the%20items%20I've%20been%20trying%20to%20tackle%20is%20how%20to%20move%20a%20site%20page%20between%20site%20collections%20(two%20different%20communication%20sites).%26nbsp%3B%20In%20the%20same%20Site%20Pages%20library%2C%20this%20is%20simple.%26nbsp%3B%20The%20usage%20case%20scenario%20here%20would%20be%20if%20we%20have%20a%20designated%20%22UAT%22%20environment%20where%20users%20modify%20their%20site%20pages%20to%20their%20exact%20specifications.%26nbsp%3B%20Right%20now%20the%20only%20way%20I%20know%20of%20is%20to%20manually%20recreate%20this%20page%20in%20the%20destination%20site.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20been%20working%20through%20the%20features%20of%20the%20Office%20DEV%20PnP%20PowerShell%20framework%20using%20the%20ClientSidePage%20objects%2C%20but%20it%20doesn't%20appear%20through%20development%20that%20this%20functionality%20is%20quite%20there%20to%20read%20a%20site%20page%2C%20then%20add%20a%20site%20page%20at%20a%20new%20target%20based%20on%20that.%26nbsp%3B%20Also%20tried%20varying%20other%20methods%20of%20moving%20files%20between%20sites%20to%20see%20if%20it%20would%20'magically'%20just%20work%20with%20no%20luck.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHas%20anyone%20ever%20tried%20or%20have%20come%20up%20with%20a%20solution%20similar%20to%20that%20in%20which%20I'm%20seeking%3F%3CBR%20%2F%3E%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFYI%3A%20Sharegate%20has%20been%20tried%20and%20also%20does%20not%20have%20that%20capability%20as%20they%20probably%20base%20their%20migrations%20on%20what's%20available%20to%20use%20already.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-135209%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-358774%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-358774%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20getting%20this%20error.%20Have%20someone%20resolved%20this%3F%3CBR%20%2F%3EGet-PnPFile%20%3A%20The%20WriteObject%20and%20WriteError%20methods%20cannot%20be%20called%20from%20outside%20the%20overrides%20of%20the%20BeginProcessing%2C%20ProcessRecord%2C%3CBR%20%2F%3Eand%20EndProcessing%20methods%2C%20and%20they%20can%20only%20be%20called%20from%20within%20the%20same%20thread.%20Validate%20that%20the%20cmdlet%20makes%20these%20calls%20correctly%2C%3CBR%20%2F%3Eor%20contact%20Microsoft%20Customer%20Support%20Services.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-304438%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-304438%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2457%22%20target%3D%22_blank%22%3E%40Alexander%20Tihme%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPnP%20worked%20for%20me%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3EMy%20approach%20was%20simple.%20I%20downloaded%20the%20page%20as%20a%20file%20to%20my%20local%20machine%20using%3B%3C%2FP%3E%3CP%3EGet-PnPFile%20-Url%20'%2Fsites%2Fintranet%2FSitePages%2Fmyfile.aspx'%20-Path%20'C%3A%5CPages'%20-Filename%20'myfile.aspx'%20-AsFile%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20upload%20to%20the%20target%20site%20using%3B%3C%2FP%3E%3CP%3EAdd-PnPFile%20-Path%20'C%3A%5CPages%5Cmyfile.aspx'%20-Folder%20%22SitePages%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20will%20have%20to%20change%20some%20Webpart%26nbsp%3Bsettings%20after%20the%20file%20is%20uploaded.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20to%20PnP%20Team%3C%2FP%3E%3CP%3ECheers!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPrabath%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-221887%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-221887%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F55975%22%20target%3D%22_blank%22%3E%40Jarrett%20Haynes%3C%2FA%3E%2C%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F88473%22%20target%3D%22_blank%22%3E%40Mia%20Loh%C3%A9%20Chung%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Edid%20you%20find%20a%20solution%20for%20this%20problem.%20I%20face%20the%20same%20issue%20at%20the%20moment.%20I've%20tried%20ShareGate%20(access%20denied%20with%20global%20admin%2C%20site%20coll%20admin%2C%20etc.)%20and%20looked%20at%20PnP%20and%20PowerShell%2C%20but%20there%20doesn't%20seem%20to%20be%20a%20way%20to%20copy%20or%20move%20a%20site%20page%20from%20the%20pages%20library%20to%20another%20site%20collection%20within%20the%20same%20tenant.%20The%20source%20site%20is%20a%20modern%20page%20of%20type%20communication%2C%20the%20target%20site%20is%20a%20modern%20page%20of%20type%20team%20site.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20any%20response.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlex%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-136061%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-136061%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Jarrett%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFull%20disclosure%2C%20I%20work%20for%20Sharegate%20%3A)%3C%2Fimg%3E%20The%20tool%20should%20be%20able%20to%20perform%20your%20action%20without%20any%20issues.%20Can%20you%20send%20an%20email%20to%20the%20support%20team%3F%20They'd%20love%20to%20take%20a%20look%20with%20you%20to%20identify%20the%20problem.%20Good%20luck!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-900693%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-900693%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20command%20you%20shared%20is%20to%20save%20page%20and%20upload%20it%20to%20same%20site%20collection%20under%20sitepages%20folder%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1092416%22%20slang%3D%22en-US%22%3ERe%3A%20Copy%20Site%20Pages%20(ClientSidePage)%20Site%20to%20Site%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1092416%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F85829%22%20target%3D%22_blank%22%3E%40Prabath%20Fonseka%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELooks%20like%20a%20proper%20business%20process%20flow%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

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!

6 Replies
Highlighted

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!

Highlighted

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

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

Highlighted

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.

Highlighted

The command you shared is to save page and upload it to same site collection under sitepages folder?

Highlighted

@Prabath Fonseka 

Looks like a proper business process flow

Related Conversations
Documentation Migration
SunLeo in Office 365 on
0 Replies
Drag and drop modern pages feature removed
David Bishop in SharePoint on
2 Replies