I have a development environment, a test environment and a production environment. I develop packages in the development environment and update the solution in the test environment. As it turns out my PageLayout didn't change according to the development environment. I asked a colleague what could be wrong and we started investigating.
As it turns out, the PageLayout didn't change, and hasn't changed for over a year. But the field TaskDueDate failed since it was written in Swedish. Since this is a test environment I changed the field in SharePoint designer to the correct name, and the pages refering the PageLayout started to work as expected.
So my colleage and I decided to Re-Ghost the PageLayout to its Ghosted state to be able to deploy it from our development environment created package. I found a useful beginning of a script and run it just to test what I got.
$site = Get-SPSite https://intranet.company.se
$web = $site.RootWeb
$pubSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site)
$pageLayouts = $pubSite.PageLayouts
foreach ($pageLayout in $pageLayouts)
{
$file = $web.GetFile($pageLayout.ServerRelativeUrl)
if ($file.CustomizedPageStatus -eq "Customized")
{
Write-Host "Layout page name: " $file.Name
Write-Host " Status before: " $file.CustomizedPageStatus
#$file.RevertContentStream()
Write-Host " Status after: " $file.CustomizedPageStatus
}
}
$web.Dispose()
$site.Dispose()
As it turns out there where four of 20 PageLayouts that was UnGhosted according to the above script. This is unexpected and I find myself caught in the middle. Should I save the current UnGhosted PageLayouts as a backup and Re-Ghost them and see what happens - or should I leave them in UnGhosted (un-deployable) mode?