1

I recently tried to delete a Multi-line Text Field from a custom Content Type. I then attempted to delete this field, and re-create it as a Single line of text under the same field name.

After realizing that it wouldn't let me do this, I then used the below javascript command:

javascript:g_FieldName={};alert('Successfully cleared forbidden columns');

This allowed me to create the field with the deleted column's name, just as I wanted.

However, now when I use a CAML query to pull this data into an SSRS report, it pulls the old fields data.

How can I completely remove a field from a Content Type? Is this possible using Powershell?

1 Answer 1

3
#get web and ct
$web = Get-SPWeb http://your/site/name
$ct = $web.ContentTypes["CT name"]

#get the column from the web
$spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink ($web.Fields["alias"])

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

#dispose the web-object
$web.Dispose()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.