Question

Did a lot of research and tests but can't find a working solution. I have a few aspx site pages and I want to back them up onto network drive or my c drive because I don't want to lose them. but I cannot find a easy way to back them up. i have tried trying to download from the site pages but it doesn't show right when i save it outside of SharePoint. then I tried going to SharePoint designer and extracting the file from there. it keeps in a aspx file that opens up to code when its save outside of SharePoint. I may be on the right path but must being missing something. can someone help me?

Was it helpful?

Solution

You can use PowerShell cmdlets to do that.

A demo for your reference:

$web = Get-SPWeb "http://sp13/sites/team" 
$list = $web.lists["Site Pages"] 
$items = $list.items 


 foreach($item in $items) 
 {

    $ie = new-object -ComObject "InternetExplorer.Application"
    $url = "http://sp13/sites/team/"+ $item.Url
    $ie.silent = $true
    $ie.navigate($url)
    while($ie.Busy) { Start-Sleep -Milliseconds 100 }
    Start-Sleep 10
    $targetFilePath=$item.DisplayName
    $ie.Document.documentElement.innerHTML > "C:\Pages\$targetFilePath.html"
    $ie.Stop()
    $ie.Quit()
 }

More information, you can refer to: Archive SharePoint aspx pages as html

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top