1

How can I hide and show fields in lists forms using PowerShell

1
  • 1
    you could use CSOM within powershell and set field's ShowInNewForm property.
    – Aveenav
    Commented Sep 8, 2017 at 19:31

1 Answer 1

1

To hide a specific field in New/Edit form via PowerShell, check the below script

$rootWeb = Get-SPWeb http://your site
#Get an reference to the  list
$list=$rootWeb.Lists["your list"]                           
#Get a reference to the created field
$Field = $list.Fields["yourfield"]
#show the column in New and Edit form
$Field.ShowInEditForm = $false
$Field.ShowInNewForm = $false        
#Push field Update
$Field.Update()

To show specific field in New/Edit form via PowerShell, check the below script

$rootWeb = Get-SPWeb http://your site
#Get an reference to the  list
$list=$rootWeb.Lists["your list"]                           
#Get a reference to the created field
$Field = $list.Fields["yourfield"]
#Hide the column in New and Edit form
$Field.ShowInEditForm = $true
$Field.ShowInNewForm = $true
#Push field Update
$Field.Update()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.