How to Hide a Field in Content Type using PowerShell?

Requirement: Hide the content type field in SharePoint list forms.

How to Hide a Field in Content type in SharePoint?

You can hide a column appearing from all forms of the list, such as NewForm.aspx, EditForm.aspx, DispForm.asxp using content type. Follow these steps to hide a field in the content type.

  1. Go to List Settings >> Advanced Settings >> Enable “Allow management of content types” and check the box. Once content types are enabled, you can hide any field of that content type.
  2. Go to List Settings again >> Under Content Types Click on Item content type (or whatever content type applicable) 
  3. Click on the Title column (or the column you wish to hide) under columns group >> Click on the “Hidden (Will not appear in forms)” option.
    sharepoint hide field in content type
    This makes the column hidden in the content type.

SharePoint: Hide a Content Type Field using PowerShell

Here is how to use PowerShell to hide a field from content type in SharePoint. Once you execute this script, the field will be hidden in the content type, meaning that users cannot see or edit the field when they are working with the content type.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set config variables
$ListName ="Projects"
$ContentTypeName="Project Template"
$FieldName="EstimatedCost" #Internal Name

#Get Web and Objects
$Web = Get-SPWeb $WebURL
$List = $Web.Lists[$ListName]

$ContentType = $List.ContentTypes[$ContentTypeName]
$Field = $ContentType.FieldLinks[$FieldName]
$Field.Hidden = $True

Write-Host "Content Type Hidden from all forms in the List!" 

Related Posts:

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

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