This is a handy way to move pages from one site to a completely different site in SharePoint. Note, that I was able to move pages from a 2010 site into a 2013 site where the page layout used did not exist on the 2013 site. This involves running a powershell script to update the page layouts to the body only 2013 layout.
1st open the 2010 pages library in explorer mode and copy the folder containing the page you want to move. Then paste them into the 2013 pages library. At this stage the pages may break as they reference a page layout that does not exist in the 2013 site.
Now run the following script to update the page layouts to the body only 2013 layout:
$spWeb = Get-SPWeb("http://siteURL")
$list = $spWeb.Lists["Pages"]
foreach ($folderItem in $list.Folders)
{
if($folderItem.Name -eq "FolderName")
{
Write-Host "Folder: " $folderItem.Name "Count: " $folderItem.Folder.ItemCount
foreach($file in $folderItem.Folder.Files)
{
Write-Host "File name is " $file.Name
$file.CheckOut("Online",$null)
$file.Properties["PublishingPageLayout"] = "/_catalogs/masterpage/PageFromDocLayout.aspx, Body only"
$file.Update()
$file.CheckIn("Update page layout via PowerShell",[Microsoft.SharePoint.SPCheckinType]::MajorCheckIn)
Write-Host "Layout updated"
}
}
}
No comments:
Post a Comment