Sharepoint 2010: How to remove columns from content types using powershell

By peter.stilgoe









Some columns once added to a content type dont allow you to remove them, you dont got a delete button. To delete one such column from your cotent type you can use the following Sharepoint Powershell Script:

#Attach to the web and content type
$web = Get-SPWeb http://fldev003/sites/pjstest/
$ct = $web.ContentTypes["Post"]

#Get link to the columnn from the web
$spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink ($web.Fields["Page Image"])

#Remove the column from the content type and update
$ct.FieldLinks.Delete($spFieldLink.Id)
$ct.Update()

#Dispose of the web object
$web.Dispose()




Share

Leggi tutto