Modern SharePoint Online Programming - Chapter 11


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 -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:

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


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: 

Happy Modern SharePoint Programming!