Hide SharePoint calculated columns from display form with PowerShell

HidingWhile creating a column which hyperlinked through to another list I’d created a few calculated columns which were showing up in the display form of items.

You can’t hide calculated columns in the same way as with regular columns, some of these pains are mentioned in the reference sites.

Below is the PowerShell I used in the SharePoint 2010 Management Shell to hide them.

I’ve commented out two options since they are quite useful to retain in most circumstances.

 

PowerShell Code

$web = get-spweb http://root/sites/site
$list = $web.Lists["list name"]

$field = $list.Fields["Column Name"]
$field.ShowInDisplayForm = $false
$field.ShowInEditForm = $false
# $field.ShowInListSettings = $false
# $field.ShowInVersionHistory = $false
$field.ShowInViewForms = $false
$field.ShowInNewForm = $false

$field.Update($true)
$web.Site.Dispose()

 

References

http://www.ilovesharepoint.com/2008/10/hide-columns-in-sharepoint-forms-with.html

http://www.endusersharepoint.com/STP/viewtopic.php?f=10&t=936

http://social.technet.microsoft.com/Forums/sharepoint/en-US/4c07a7fc-d80b-4b3a-b3df-bd3e869ac606/set-a-calculated-column-as-hidden-in-a-content-type

 

[aboutme username=”ashley.lawrence”]