=================================
Hide List ContentType Field using Powershell script
======================================
Hide List ContentType Field using Powershell script
======================================
$siteUrl = "http://servername/sites/P128023/"
[system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint") > $null
$site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$RootWeb = $site.RootWeb
$lookForList ="Events"
$EventsList= $RootWeb.Lists[$lookForList]
if ($EventsList -ne $null)
{
$MissionContentType = $EventsList.ContentTypes["Mission"]
$field = $MissionContentType.FieldLinks["Category"]
$field.Hidden = $true
$MissionContentType.Update();
$EventsList.Update()
}
if ($site) {$site.Dispose()}
if ($RootWeb){ $RootWeb.Dispose()}
==========================================================
Hide ContentType Field using Powershell script
===========================================================
==========================================================
Hide ContentType Field using Powershell script
===========================================================
$siteUrl = "http://spdev5:8002/sites/library/"
[system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint") > $null
$site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$RootWeb = $site.RootWeb
$MyContentType=$RootWeb.ContentTypes["CV"]
$MyField=$MyContentType.Fields["SAIC
DOC"]
$MyContentType.FieldLinks[$MyField.Id].Hidden =$true
$MyContentType.Update($true)
write-host "updated" $field.type
if ($site) {$site.Dispose()}
if ($RootWeb){
$RootWeb.Dispose()}
Thanks - useful snippets
ReplyDeleteThanks a lot Surya !!!... you saved my day I have tried different ways to hide the content type column without successful.. Finally you lead me to success.. great snippet once again thanks a lot…
ReplyDelete