作者:手机用户2502856183 | 来源:互联网 | 2024-11-03 03:49
通过连接到SharePoint站点并使用PowerShell命令,可以高效地配置列表字段属性。具体步骤包括:首先使用`Connect-PnPOnline`命令连接到目标站点,例如`Connect-PnPOnline-Urlhttp://dvt193:112`。然后,利用`Set-PnPField`命令修改所需字段的属性,如`Set-PnPField-List"权限测试"-Identity"权限栏目"`。这种方法不仅简化了管理流程,还提高了操作的准确性和效率。
--连接站点
Connect-PnpOnline -url http://dvt193:112
--修改属性
Set-PnPField -List "权限测试" -Identity "权限栏目" -Values @{$ShowInViewForms = $false}
$list=get-pnplist -Identity 权限测试 set-pnpfield -List $list -identity 权限栏目 -Values @{Required="true"}
字段显示属性找不到,可以使用shell脚本设置
#Get the web, list and column objects
$web = Get-SPWeb http://dvt193:112
$list = $web.Lists["权限测试"]
$column = $list.Fields["权限栏目"]
#Change the ShowInEditForm property and update objects
$column.ShowInDisplayForm = $false
$column.ShowInNewForm = $false
$column.ShowInEditForm = $false
$column.Update()
$list.Update()
$web.Dispose()
#Get the web, list and column objects
$web = Get-SPWeb http://dvt193:85
$list = $web.Lists["公司列表模板new"]
$column = $list.Fields["发布时间"]
$column1 = $list.Fields["审批时间"]
$column2 = $list.Fields["审批人"]
#Change the ShowInEditForm property and update objects
$column.ShowInDisplayForm = $false
$column.ShowInNewForm = $false
$column.ShowInEditForm = $false
$column1.ShowInDisplayForm = $false
$column1.ShowInNewForm = $false
$column1.ShowInEditForm = $false
$column2.ShowInDisplayForm = $false
$column2.ShowInNewForm = $false
$column2.ShowInEditForm = $false
$column.Update()
$column1.Update()
$column2.Update()
$list.Update()
$web.Dispose()