Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint / SharePoint2010

Hiding SharePoint list field (column) from newform and editform using powershell - SharePoint 2010

0.00/5 (No votes)
3 Sep 2013CPOL 19.2K  
Power shell command to hide a particular column in a sharepoint list from the newform and editform.

Introduction

Power shell command to hide a particular  column in a SharePoint list from the newform and editform. 

Using the code

Use the below power shell command to hide a particular  column in a SharePoint list from the newform and editform. 

C++
$WebUrl = "http://sitecollectionurl"
Write-Host "Opening Web" $WebUrl
$web = Get-SPWeb $WebUrl


$list = $web.Lists["ListName"];


$FieldGuid = New-Object System.Guid("cc9576b6-a166-47c9-bd89-7f47a3237e03");
$Field = $list.Fields[$FieldGuid];

$Field.ShowInNewForm = $false;
$Field.ShowInDisplayForm = $true;
$Field.ShowInEditForm = $false

$Field.Update();

$list.Update();
<span style="font-size: 14px; white-space: normal;">
</span>

Here, replace the $WebUrl with your site collection URL, and replace the "ListName" with your SPList name.

And replace the Guid"cc9576b6-a166-47c9-bd89-7f47a3237e03" with the id of the field to be hidden.

For getting the id of the field , you can use 'SharePoint Manager' tool and will be downloaded from here. Its from codeplex and it is free. 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)