Yes, the short answer is you can't do anything to the field if you accidently deployed it with a version attribute. Whoops.
As this is something I've done a few times - ow - and I needed to fix, I've finally gotten around to writing a script to fix it. The script needs to remove the current field from all content types, then delete the field. Then remove the version attribute, then add the field and then finally add it back to the content types. So simple, much pleasure.
It takes the url to the web to update the field in, and the name of the field to 'fix'. It grabs an array of the content types that it needs to work with ($contenttypenames) and uses that at the end to put the field back. I've tested it lightly, so try it on a dev server first.
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)][string]$url,
[Parameter(Mandatory=$True,Position=2)][string]$name
)
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction:SilentlyContinue
Set-Location (Split-Path -Path:$MyInvocation.MyCommand.Path -Parent:$true)
Write-Host ("Remove Version flag from '{0}' in '{1}'" -f $name, $url)
$web = Get-SPWeb $url
$web = $web.site.RootWeb
$field = $web.Fields.GetFieldByInternalName($name)
if (!$field) {
Write-Host "> Can't find field!" -ForegroundColor:Red
break
}
[xml]$xml = $field.SchemaXml
$contenttypenames = $web.ContentTypes | ? { $_.FieldLinks | ? { $_.Id -eq $field.ID } } | ? { $_.Parent.Fields.ContainsFieldWithStaticName($field.InternalName) -eq $false } | % { Write-Output $_.Name }
$contenttypenames | % {
$contenttypename = $_
write-host ("> Remove field link from {0}..." -f $contenttypename) -ForegroundColor:Green
$ct = $web.ContentTypes[$contenttypename]
$ct.FieldLinks.Delete($name)
$ct.UpdateIncludingSealedAndReadOnly($true)
}
$field = $web.Fields.GetFieldByInternalName($name)
if ($field) {
Write-Host "> Deleting existing field..." -ForegroundColor:Green
$web.fields.Delete($name)
}
Write-Host "> Adding field (version removed)..." -ForegroundColor:Green
$xml.Field.RemoveAttribute("Version")
$web.Fields.AddFieldAsXml($xml.OuterXml) | Out-Null
$contenttypenames | % {
$contenttypename = $_
Write-Host ("> Adding field link to {0}..." -f $contenttypename) -ForegroundColor:Green
$field = $web.Fields.GetFieldByInternalName($name)
$fieldlink = New-Object Microsoft.SharePoint.SPFieldLink($field)
$ct.FieldLinks.Add($fieldlink)
$ct.Update($true)
}