How to hide Sharepoint List columns from Display form with powershell commad
[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)
$url = "url of your site";
$list = "List Name"; #list name
$fieldname = "Person"; # Field name
#Setting up context
$contextSite = New-Object Microsoft.SharePoint.SPSite($url);
$contextWeb = $contextSite.OpenWeb();
$list = $contextWeb.Lists.TryGetList($list);
$field = $list.Fields[$fieldname];
# Controls Field in New Form
$field.ShowInDisplayForm = 0; #3 if you want to show then run again with 1 instead of 0 (1= true , 0=flase)
# Don't forget to update this field
$field.Update();
# And finally dispose everything.
$contextWeb.Dispose();
$contextSite.Dispose()
$url = "url of your site";
$list = "List Name"; #list name
$fieldname = "Person"; # Field name
#Setting up context
$contextSite = New-Object Microsoft.SharePoint.SPSite($url);
$contextWeb = $contextSite.OpenWeb();
$list = $contextWeb.Lists.TryGetList($list);
$field = $list.Fields[$fieldname];
# Controls Field in New Form
$field.ShowInDisplayForm = 0; #3 if you want to show then run again with 1 instead of 0 (1= true , 0=flase)
# Don't forget to update this field
$field.Update();
# And finally dispose everything.
$contextWeb.Dispose();
$contextSite.Dispose()
great work
ReplyDeletethanks
Delete