Wednesday, April 15, 2020

Copy SharePoint Online Site Pages with PNP

No option to copy Site Pages from one SharePoint Online site to different SharePoint online site



No option to Copy the site page from one site to different SharePoint Online site


Use PNP to copy site pages in SharePoint online



Set the credentials to connect to PNPOnline


$userid=''
$mypassword = ''
$O365Credential = New-Object
System.Management.Automation.PsCredential($userid$mypassword)

Connect to Source SharePoint Online site using PNP

$sourceURLRead-Host 
Connect-PnPOnline -Url $sourceURL -Credential $O365Credential

Provision a template of Source Site Pages

$outputXMLLocation = Read-Host
Get-pnpprovisioningtemplate -out $outputXMLLocation\pages.xml
-handlers PageContents -IncludeAllClientSidePages

Apply the template to destination SharePoint online site

apply-pnpprovisioningtemplate $outputXMLLocation\pages.xml