woensdag 24 oktober 2012

RichHtmlField for custom field not rendering HTML

I had multiple RichHtmlFields on my page, and one was displaying correctly while another was not.  When I viewed the fields via the powershell, I noticed a difference in the SchemaXML, the WORKING field had the following additional properties:

     RichText="True"
     RichTextMode="FullHtml"

I found a script to update the problem field, and the problem went away for me (look below for script). The change has to be made at the list level for it to take affect on existing pages/lists, but I believe making the modification to the column at the root web (or correct subweb) would work as well.     
     $web = $site.OpenWeb($site.RootWeb.ID)
     $list = $web.Lists["Pages"]
     [Microsoft.SharePoint.Publishing.Fields.HtmlField]$field =   [Microsoft.SharePoint.Publishing.Fields.HtmlField]$list.Fields.GetFieldByInternalName("PageContentFld")
     $field.RichText = $true
     $field.RichTextMode = [Microsoft.SharePoint.SPRichTextMode]::FullHtml
     $field.Update()
     $list.Update()

You may want to check your field to make sure those properties are set.


Geen opmerkingen:

Een reactie posten