Ensure_ContentType_Column_Excludes

Language:
PowerShell
Keywords:
SharePoint
Code Snippet

Function Ensure_ContentType_Column_Excludes( [Microsoft.SharePoint.SPContentType]$tContentType
                                          , $tFieldName
                                          ) {
    if ($tContentType.Fields.ContainsField($tFieldName)) {
        Write-Output([System.String]::Format("Column [{1}] : Deleting from Content Type [{0}]", $tContentType.Name, $tFieldName))
        $tContentType.FieldLinks.Delete($tFieldName)
        $tContentType.Update()
    }
} # Function Ensure_ContentType_Column_Excludes(...)


Created 2011-10-13
comments powered by Disqus
Login