65.9K
CodeProject is changing. Read more.
Home

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

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Sep 3, 2013

CPOL
viewsIcon

19220

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. 

$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();

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.