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 # 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

2 Replies to “Hiding a Default SharePoint 2010 Content Type Field”

  1. I like this solution.. and PS too) But could you use this if a library consists of two content types (folder and document)? By default Title field is hidden for folder's content type, how can i make it visible for a particular library? Thank you

  2. You can hide the field for a specific content type by using the script: $site = get-spsite http://intranet $rw = $site.RootWeb $list = $rw.Lists["Shared Documents"] $ct = $list.ContentTypes["Document"] $field = $ct.FieldLinks["Title"] $field.Hidden = $true $ct.Update() $list.Update() This should only hide the field for the content type specified, rahter than the field in the list as a whole. Andy

Leave a Reply to Andy Cancel reply

Your email address will not be published. Required fields are marked *