Forum Discussion

arine1901's avatar
arine1901
Brass Contributor
Oct 25, 2023

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

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

  • Rob_Elliott's avatar
    Rob_Elliott
    Bronze Contributor

    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's avatar
      arine1901
      Brass Contributor

      Thanks for your help Rob_Elliott 

       

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

       

      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


    • arine1901's avatar
      arine1901
      Brass Contributor

      HelloBenTeoh 

      Thanks for your recommendation! 

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

       

       

      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

      • BalasahebKahat's avatar
        BalasahebKahat
        Copper Contributor
        I am also facing same issue. Did you guys find any solution on this issue?

Resources