Question

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?

Was it helpful?

Solution

If it's solely on the test environment and not on the production environment (hence the "test"), you can safely revert the filestream so that the content is retrieved from the file system.

Since there are only 4 page layouts unghosted, you can grab them from the master page gallery ("download a copy") on that environment and apply a comparison with the one you have on your packages, in order to synchronise them and apply the relevant modifications (if any) in your dev environment / package. (BeyondCompare is a really nice tool for that but there are a lot of them).

What about the production environment ? Does it have unghosted / customized page layout ? Would you be able to do the same operation (launch that PowerShell script) if it was the case ?

Finally a good old stsadm -o backup as a safe net is always welcome, just in case anything bad happens (unable to revert filestream, missing content added manually, broken page layout,etc).

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