$group_list = Import-Csv 'C:\WW\SiteList.csv' $srcUrl = "https://shared.sharepoint.com/sites/fj-mech-dev/" $pageName = "Home-Team.aspx" #$cred = Get-Credential Connect-PnPOnline -Url $srcUrl -Credentials $cred #$Cred=Get-Credential foreach ($group in $group_list) { try { $destUrl = $group.SiteName #Read-Host "Enter the destination site url" $tempFile = [System.IO.Path]::GetTempFileName(); Export-PnPClientSidePage -Force -Identity $pageName -Out $tempFile Connect-PnPOnline -Url $destUrl -Credentials $cred Invoke-PnPSiteTemplate -Path $tempFile $group.SiteName Write-Host "ModernPage is successfully copied." sleep 10 Set-PnPHomePage -RootFolderRelativeUrl "sitepages/Home-Team.aspx"#$pageName } catch { $group.SiteName Write-Host -ForegroundColor Red 'Error ', ':' $Error[0].ToString(); sleep 10 } }
Tuesday, August 30, 2022
Copy page from one sharepoint site to other sharepoint site
Subscribe to:
Post Comments (Atom)
HTML
Script:
No comments:
Post a Comment