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

本文介绍如何使用PowerShell命令来实现在SharePoint列表的新建和编辑表单中隐藏特定的列。通过调整示例代码并替换必要的参数,如网站集合URL、列表名称及待隐藏字段的GUID,即可实现需求。
$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. 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值