Modern SharePoint Online Programming - Chapter 11

Introduction 

 
Hi guys, let’s explore a new and amazing way to do modern site pages migration using PnP PowerShell from two different Modern Site Collections that can bellow to the same Tenant or different Tenants in SharePoint Online.

Use the below Scripts to run on your Windows PowerShell ISE Application:

Connect-PnPOnline https://crosssharenet.sharepoint.com/sites/WebPartCatalog -useweblogin

Get-PnPProvisioningTemplate -Out DemoPages.xml -Handlers PageContents -IncludeAllClientSidePages

code DemoPages.xml
 
#Opens the above XML file in Visual Studio code for reviewing and any tunings:
 
Connect-PnPOnline https://crosssharenet.sharepoint.com/sites/TestSiteDesign

Apply-PnPProvisioningTemplate .\DemoPages.xml
#Replace above crossharenet with your respective Source and Target Tenants as I am working on some Dummy Tenant for Presentation 
 
 
 

PromoteAsTemplate="true" 

For pages in the DemoPages.xml file generated, that you wish to be promoted to Templates for further reusability.
 
Verify your Target Site collection Page section:

 

Note: The above feature is also available on OnPrem 2019 only along with Modern SharePoint Online. Delta Handling of the above process can be done by adding -Overwrite attribute in the Apply PnP script.

PnPScriping can be used for creating Lists, Fields, Content Types, Create Teams, Provision/Extracting Taxonomy, Pages, Classic Pages, Master Pages, Set the Logo… and any kind of attributes we think of. For more PnP concepts exploring please check: https://www.youtube.com/watch?v=1GPPxunPI40&list=RDCMUC_mKdhw-V6CeCM7gTo_Iy7w&start_radio=1 

Happy Modern SharePoint Programming!