Click here to Skip to main content
15,884,298 members
Articles / Productivity Apps and Services / Sharepoint / SharePoint 2010
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
3 Sep 2013CPOL 19K   1  
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)


Written By
Technical Lead Infosys Limited
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --