I just migrated a SharePoint side from 2010 Foundation to SharePoint 2013 Foundation and discovered that the most important column in my Libraries was no longer rendering the HTML it needed. Instead, it was just displaying the HTML. It should be displaying an image in the 15 Hive based on the Date Today and the Report Status. I discovered that Calculated Columns were now disabled by default in SharePoint 2013 and up and that I had to disable this by default. Using the PowerShell below I was able to disable it, however it still would not render the image. I then discoved that the Calculated Column MUST be a Number Data Type and NOT a Single Line of Text that it was in SharePoint 2010.
Just to add to the pain, I was using the Today trick for a column that is referenced in the formula. This is where you create a column that defaults to Today's Date, apply the formula and then delete the Today Column. I accomplished this using some PowerShell and at the same time changed the Data Type to a Number.
Switch if OFF - The Calculated Column Must be a Number output type
$webApp = Get-SPWebApplication https://mySPSite.com
$webApp.CustomMarkupInCalculatedFieldDisabled = $false
$webApp.Update()
Script for updating the Calculated column to a Number Data Type and with the Today Column Added and Deleted after the formula was updated.
if($doesTodayFieldExist -eq $false)
{
Write-Host "Creating Today Field" -ForegroundColor DarkBlue
$dateTimeFieldType = [Microsoft.SharePoint.SPFieldType]::DateTime
$fieldName = $list.Fields.Add("Today", $dateTimeFieldType, $false)
$list.Fields[$fieldName].DefaultValue = "[Today]"
Write-Host "Updating List" -ForegroundColor DarkBlue
$list.Update()
}
$field = $list.Fields["Status"]
if($field.Title -eq "Status" -and $field.Type -eq "Calculated")
{
Write-Host "Updating Calculated Column" -ForegroundColor DarkBlue
$field.Formula = "=Formula Goes here!"
# For SharePoint 2013 and up this must be a number field
$field.OutputType = [Microsoft.SharePoint.SPFieldType]::Number
Write-Host "Updating Field" -ForegroundColor DarkBlue
$field.Update()
Write-host "Updating List" -ForegroundColor DarkBlue
$list.Update()
}
$field = $list.Fields["Today"]
if($field -ne $null)
{
Write-host "Deleting Today Field" -ForegroundColor DarkBlue
$field.Delete()
Write-host "Updating List" -ForegroundColor DarkBlue
$list.Update()
}