Another task that’s much harder than it should be. Setting the hidden property of a SPField to false.
First you get the field itself. In this example we change the setting of the field in the library, but it could just as well be done on the site level.
$web = Get-SPWeb http://MyWeb $list = $web.Lists["MyList"] $field = $list.Fields.GetFieldByInternalName("MyField")
Then, when you have the actual field, you just need a bit of reflection magic.
$type = $field.GetType() $mi = $type.GetMethod("SetFieldBoolValue",[System.Reflection.BindingFlags]$([System.Reflection.BindingFlags]::NonPublic -bor [System.Reflection.BindingFlags]::Instance)) $mi.Invoke($field, @("CanToggleHidden",$true)) $field.Hidden=$false $field.Update()
I don’t know why, but simply setting field.Hidden = $false doesn’t work. But the code above does!
Solution comes from here.