Copy Site Page from one site collection to other site collection using PnP-PowerShell
try{
$srcSiteURL = "https://xxxxx.sharepoint.com/sites/xxxxx/"
$destSiteURL = "https://xxxxx.sharepoint.com/sites/yyyyy/"
$pageName = "test.aspx"
Connect-PnPOnline -Url $srcSiteURL -Credentials SharepointCredential
$tempFile = [System.IO.Path]::GetTempFileName();
Export-PnPClientSidePage -Force -Identity $pageName -Out $tempFile
Connect-PnPOnline -Url $destSiteURL -Credentials SharepointCredential
Apply-PnPProvisioningTemplate -Path $tempFile
Write-Host "Success"
}
catch{
Write-Host -ForegroundColor Red 'Error ',':'$Error[0].ToString();
}
Reference Link:
https://pnp.github.io/powershell/cmdlets/Export-PnPPage.html
No comments:
Post a Comment