RichHtmlField contents not displayed

Bronze Contributor

Strange problem here...


We are using a PnP Provisioning Template to provision a Publishing Site. The welcome page for our Publishing Site uses a custom Page Layout bound to the out-of-the-box Welcome Page Content Type. In our Page Layouts we make use of RichtHtmlField controls to render Page Content from the PublishingPageContent field in the underlying List Item.


<PublishingWebControls:RichHtmlField FieldName="PublishingPageContent"/>

After Provisioning (overwriting the existing Page), the Field's content is not displayed on the Page until we edit the Page and re-publish it. Once in Edit Mode we can see the content and after saving it appears on the Page in Display Mode also.


The Welcome Page Content Type is added to our Library and the Page Layout is configured to be allowed in the site. We also checked to make sure the Page's ContentType and PageLayout are set correct. 


Any ideas?

2 Replies

I'm assuming that you are applying a template. Can you check the xml of the template for

< pnp:Files> 


In there you should find 


< pnp: Property Key="PublishingPageContent" Value="Whatever content that should appear" />


It sounds a bit like your page isn't being published and hence the current version doesn't appear. 



We're overwriting an existing File here and we don't know what content is inside the PublishingPageContent field when we're overwriting the file (unless we'd check for it and add the File Property programmatically). We're indeed applying a Template defined in XML. We specified overwrite=true here because we want newly defined WebParts to be added to the Page for example.


Today I've compared the ListItem Field values as well as the File Properties for both a correctly rendering Page and a not correctly rendering Page. For the Page not rendering correctly I've noticed the File Properties were different from a correctly rendering Page. Not surprisingly, the File Properties for the correctly rendered Page contained a property for PublishingPageContent where the not correctly rendered Page did not.


Ultimately I wrote an ExtensibilityHandler that Syncs the relevant properties from the underlying List Item (in ListItemAllFields) with the File Properties using File.SetFileProperties which effectively just updates File.ListItemAllFields. I guess under the hood this causes the File Properties to be set correctly and the contents to be rendered.


I'm not sure yet if this is a bug and if so if it's a bug in PnP or CSOM itself, but for now I have a workaround!