0

How can I backup my SharePoint pages resided in the Site pages library of my Communication site using PnP PowerShell?

6
  • You want to copy pages from site pages library somewhere else, maybe in same library but within a folder or site pages library in another site? Mar 30, 2023 at 11:27
  • Check this: c-sharpcorner.com/blogs/…. let me know if it works for you. You might need to use Export-PnPPage instead of Export-PnPClientSidePage based on version of PnP PowerShell you are using. Mar 30, 2023 at 11:34
  • What about backup the Sharepoint pages to a folder in my explorer. Is that possible? Mar 30, 2023 at 11:39
  • check Get-PnPFile works for you: sharepoint.stackexchange.com/questions/277383/… Mar 30, 2023 at 11:42
  • I'm checking the progress of this issue. Did Ganesh Sanap 's answer help you?
    – Xyza_MSFT
    Apr 6, 2023 at 2:50

1 Answer 1

1

PnP PowerShell available to copy a modern page to another site:

#Parameters
$SourceSiteURL = "https://crescent.sharepoint.com/sites/marketing"
$DestinationSiteURL = "https://crescent.sharepoint.com/sites/branding"
$PageName =  "About.aspx"
 
#Connect to Source Site
Connect-PnPOnline -Url $SourceSiteURL -Interactive
 
#Export the Source page

    $TempFile = [System.IO.Path]::GetTempFileName()
    Export-PnPPage -Force -Identity $PageName -Out $TempFile
     
    #Import the page to the destination site
    Connect-PnPOnline -Url $DestinationSiteURL -Interactive
    Invoke-PnPSiteTemplate -Path $TempFile

Reference: https://www.sharepointdiary.com/2020/07/sharepoint-online-copy-pages-to-another-site-using-powershell.html#ixzz7y5JXpR5k

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.