Hiding a Default SharePoint 2010 Content Type Field

Extending some of the default content types available in SharePoint 2010 can result in unwanted fields being shown. An example is extending the 'Event' default content type, which has three fields attached which you don't seem to be able to edit:

Unwanted event fields

In particular, many users would like to remove the Workspace field from calendar entries:

Workspace field

Some users resort to editing the new/edit/view forms to remove the fields that are not wanted, however there is an easier way!

Using the following PowerShell, an unwanted field can be hidden so that it does not appear in the new/edit/view forms:

1
2
3 1 # Get a reference to the web we are using  2 $web  \= Get\-SPWeb https://intranet.domain.com/site  3  4 # Get a reference to the list to which the content type is attached  5 $list  \=  $web.Lists\["Holiday Calendar"\]  6  7 # Return a list of the fields  8 $fields  \=  $list.fields  9  10 # Select the field we wish to hide  11 $field  \=  $fields  | where {$\_.internalname \-eq  "WorkspaceLink"} 12  13 # Show the current 'hidden' status of the field  14 $field.Hidden 15  16 # Set the field to hidden (note that 'CanToggleHidden' must be true to allow this)  17 $field.Hidden \=  $true  18  19 # Update the field  20 $field.Update()

Creating a new holiday event on the calendar, the field allowing a user to create a workspace is now hidden:

New item form without workspace field