kwizcom banner advertisement

How to Hide a Field in Content Type using PowerShell?

Requirement: Hide content type field in SharePoint list forms

How to Hide a Field using Content types 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 field in content type.
  • Go to List Settings >> Advanced Settings >> Enable "Allow management of content types"  check the box. Once content types are enabled, you can hide any field of that content type.
  • Go to List Settings again >> Under Content Types Click on Item content type (or whatever content type applicable) 
  • Click on Title column (or the column you wish to hide) under columns group >> Click on Hidden option.
    sharepoint hide field in content type
This makes the column hidden in the content type.

SharePoint: Hide Content Type Field using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set config variables
$WebURL="http://intranet.crescent.com/"
$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
$ContentType.Update($False)

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

Related Posts:
How to Hide a Field in Content Type using PowerShell? How to Hide a Field in Content Type using PowerShell? Reviewed by Salaudeen Rajack on May 27, 2017 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.