outlook 发表于 2017-5-24 11:05:10

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

$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>


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. 
  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. 
页: [1]
查看完整版本: Hiding SharePoint list field (column) from newform and editform using powershell