Auto generating new post/page in the SharePoint site from the item of SharePoint List

Copper Contributor

Hi everyone,

 

I'm looking to create a page on SharePoint site that is generated based on the value of item from a SharePoint list.
I have created a list that has a column with the type of multiple lines of text and the specification of the type of the text is Enhanced rich text (Rich text with pictures, tables, and hyperlinks).

Does anyone have any ideas on how to generate page content from the values in this column?

Thank you

6 Replies

@arine1901 you can't do this with just SharePoint on its own, you will need to build a flow in Power Automate. There is a YouTube video showing the steps here.

 

If your list already has lots of items you could additionally add button in a single line of text column using JSON formatting to trigger the flow. The trigger in that case would need to be "For a selected item".

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP UK (and classic 1967 Morris Traveller driver)

@arine1901 You can do it with PowerAutomate using the Send an HTTP request to SharePoint action and then using the SharePoint REST API to populate your content. 

There are a few steps to get it working. 

Good luck!

Thanks for your help @Rob_Elliott 

 

I have followed the steps and adjusted my column type like this

arine1901_0-1698291818948.png

 

But I always get error BadGateway on SavePageAsDraft step.
error message: "There was an error deserializing the object of type Microsoft.SharePoint.Publishing.SitePageFieldsData. Encountered unexpected character 'E'.\r\nclientRequestId: \r\nserviceRequestId: "


This is the json body

 

{
"__metadata": {
"type": "SP.Publishing.SitePage"
},
"LayoutWebpartsContent": "[{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"Title area\",\"description\":\"Title area description\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{\"imageSource\":\"/_layouts/15/images/sleektemplateimagetile.jpg\"},\"links\":{},\"customMetadata\":{\"imageSource\":{}}},\"dataVersion\":\"1.4\",\"properties\":{\"imageSourceType\":2,\"title\":\"Test Article Template\",\"textAlignment\":\"Left\",\"showPublishDate\":true,\"authors\":[{\"id\":\"\",\"upn\":\"\",\"email\":\"\",\"name\":\"\",\"role\":\"-\"}],\"showTopicHeader\":false,\"authorByline\":[\"\"],\"layoutType\":\"NoImage\",\"topicHeader\":\"\",\"enableGradientEffect\":true,\"isDecorative\":true},\"containsDynamicDataSource\":false,\"reservedHeight\":159}]",
"CanvasContent1": "[{\"controlType\":4,\"id\":\"1212fc8d-dd6b-408a-8d5d-9f1cc787efbb\",\"position\":{\"controlIndex\":2,\"sectionIndex\":1,\"sectionFactor\":12,\"zoneIndex\":1,\"layoutIndex\":1},\"addedFromPersistedData\":true,\"innerHTML\":\"<p>@{triggerOutputs()?['body/Description']}</p>\"},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true,\"globalRichTextStylingVersion\":0,\"rtePageSettings\":{\"contentVersion\":5},\"isEmailReady\":false}}]",
"AuthorByline": [],
"TopicHeader": "",
"BannerImageUrl": "/_layouts/15/images/sitepagethumbnail.png",
"Title": "@{triggerOutputs()?['body/Title']}"
}

 

Could you help me for this? 

Regards,

Arine


@HelloBenTeoh 

Thanks for your recommendation! 

I have followed the steps and adjusted my column type like this

arine1901_0-1698293495043.png

 

 

But I always get error BadGateway on SavePageAsDraft step.
error message: "There was an error deserializing the object of type Microsoft.SharePoint.Publishing.SitePageFieldsData. Encountered unexpected character 'E'.\r\nclientRequestId: \r\nserviceRequestId: "


This is the json body

 

{
"__metadata": {
"type": "SP.Publishing.SitePage"
},
"LayoutWebpartsContent": "[{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"Title area\",\"description\":\"Title area description\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{\"imageSource\":\"/_layouts/15/images/sleektemplateimagetile.jpg\"},\"links\":{},\"customMetadata\":{\"imageSource\":{}}},\"dataVersion\":\"1.4\",\"properties\":{\"imageSourceType\":2,\"title\":\"Test Article Template\",\"textAlignment\":\"Left\",\"showPublishDate\":true,\"authors\":[{\"id\":\"\",\"upn\":\"\",\"email\":\"\",\"name\":\"\",\"role\":\"-\"}],\"showTopicHeader\":false,\"authorByline\":[\"\"],\"layoutType\":\"NoImage\",\"topicHeader\":\"\",\"enableGradientEffect\":true,\"isDecorative\":true},\"containsDynamicDataSource\":false,\"reservedHeight\":159}]",
"CanvasContent1": "[{\"controlType\":4,\"id\":\"1212fc8d-dd6b-408a-8d5d-9f1cc787efbb\",\"position\":{\"controlIndex\":2,\"sectionIndex\":1,\"sectionFactor\":12,\"zoneIndex\":1,\"layoutIndex\":1},\"addedFromPersistedData\":true,\"innerHTML\":\"<p>@{triggerOutputs()?['body/Description']}</p>\"},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true,\"globalRichTextStylingVersion\":0,\"rtePageSettings\":{\"contentVersion\":5},\"isEmailReady\":false}}]",
"AuthorByline": [],
"TopicHeader": "",
"BannerImageUrl": "/_layouts/15/images/sitepagethumbnail.png",
"Title": "@{triggerOutputs()?['body/Title']}"
}

 

Could you help me for this? 

Regards,

Arine

I am also facing same issue. Did you guys find any solution on this issue?

Hi,
if the substitution of "triggerOutputs" is working, the "E" has to be in the content of it?


The issue is that you have to quote several letters if you are using them in "innerhtml".
e.g. single double quote (") has to be written as (\\\"), backslash the same. can't provide a full list, so take care of special characters.

br Sigi