$siteUrl = "http://servername/sites/P127036/"
[system.reflection.assembly]::LoadWithPartialName("Microsoft.Sharepoint") > $null
$site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$RootWeb = $site.RootWeb
$EventsList ="MyList"
if ($EventsList -ne $null)
{
$MissionContentType = $EventsList.ContentTypes["Mission"]
$field = $MissionContentType.FieldLinks["Category"] # here u shuld not take Field
$field.Hidden = $true
$MissionContentType.Update();
$EventsList.Update()
}
# Dispose the site object
if ($site) {$site.Dispose()}
if ($RootWeb){ $RootWeb.Dispose()}
No comments:
Post a Comment