Forum Discussion
Flow to replace SharePoint site page text web part content from form entry
Hi GavinK9 , you can try also SP Pages API in Ms Graph https://devblogs.microsoft.com/microsoft365dev/microsoft-graph-api-for-sharepoint-pages-is-now-generally-available/
This method is similar to the one using CanvasContent1, but it is implemented slightly differently.
First, use the CheckoutPage action by sending an HTTP request to SharePoint:
And then HTTP request to SharePoint: to save a CanvasContent1 property of a page:
The best way to obtain a correct CanvasContent1 value is to retrieve the content from an existing page and then modify only the placeholder in the Text Web Part.
- alokkumarMay 15, 2025Copper Contributor
michalkornet , i have fetched the payload content from template page & using the same body to map the dynamic fields of my list to update the sitepage. but getting deserealizing error.. can you help me on this.. if there would be any solutions.
- michalkornetMay 19, 2025Iron Contributor
Hi alokkumar Can you maybe provide the data you’re using? Or try to get the value of this action from one of the runs, and then check if you can parse it to JSON format.
Take the CanvasContent1 value, replace \" with ", and the result should be valid JSON- alokkumarMay 19, 2025Copper Contributor
Hi michalkornet
below is the code of input. this is the example of payload of sharepoint page. but these "\n" is automatically added by power automate once i paste the body in json & started testing. i copied the same page payload but still not worked & giving this below error. Can you help me on this..
Json body example : after run failed in the raw input code (for reference).."{\n \"__metadata\": {\n \"type\": \"SP.Publishing.SitePage\"\n },\n \"CanvasContent1\": \"[{\\\"position\\\":{\\\"layoutIndex\\\":1,\\\"zoneIndex\\\":1,\\\"zoneId\\\":\\\"0177e801-5dc0-4fc2-91e7-2165afd990c0\\\",\\\"sectionIndex\\\":1,\\\"sectionFactor\\\":0,\\\"controlIndex\\\":1},\\\"id\\\":\\\"768b2b00-1b9f-4eb7-8200-07e8cf968456\\\",\\\"controlType\\\":3,\\\"isFromSectionTemplate\\\":false,\\\"addedFromPersistedData\\\":true,\\\"webPartData\\\":{\\\"id\\\":\\\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\\\",\\\"instanceId\\\":\\\"768b2b00-1b9f-4eb7-8200-07e8cf968456\\\",\\\"title\\\":\\\"Banner\\\",\\\"description\\\":\\\"Show a banner with title and author information\\\",\\\"audiences\\\":[],\\\"serverProcessedContent\\\":{\\\"htmlStrings\\\":{},\\\"searchablePlainTexts\\\":{},\\\"imageSources\\\":{\\\"imageSource\\\":\\\"/_layouts/15/images/sleektemplateimagetile.jpg\\\"},\\\"links\\\":{}},\\\"dataVersion\\\":\\\"1.6\\\",\\\"properties\\\":{\\\"imageSourceType\\\":2,\\\"title\\\":\\\"\\\",\\\"textAlignment\\\":\\\"Left\\\",\\\"showPublishDate\\\":false,\\\"authors\\\":[],\\\"showTopicHeader\\\":false,\\\"authorByline\\\":[],\\\"layoutType\\\":\\\"NoImage\\\",\\\"topicHeader\\\":\\\"\\\",\\\"enableGradientEffect\\\":true,\\\"isDecorative\\\":true,\\\"customContentDropSupport\\\":\\\"disabled\\\"},\\\"containsDynamicDataSource\\\":false},\\\"webPartId\\\":\\\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\\\",\\\"reservedWidth\\\":1236,\\\"reservedHeight\\\":141},{\\\"position\\\":{\\\"layoutIndex\\\":1,\\\"zoneIndex\\\":2,\\\"zoneId\\\":\\\"8bcfdc6e-e63e-4329-a2c0-f303af1c9ad3\\\",\\\"sectionIndex\\\":1,\\\"sectionFactor\\\":6,\\\"controlIndex\\\":1},\\\"id\\\":\\\"6c96fa6d-f3cc-4596-91cb- *** also there more.
Error code:
"body": {
"error": {
"code": 502,
"message": "BadGateway",
"innerError": {
"status": 502,
"message": "{"odata.error":{"code":"-1, System.Runtime.Serialization.SerializationException","message":{"lang":"en-US","value":"There was an error deserializing the object of type Microsoft.SharePoint.Publishing.SitePageFieldsData. Encountered invalid character '\n'."}}}\r\nclientRequestId: ff13d661-2001-4966-9b60-2815377a1a57\r\nserviceRequestId: f7ae9fa1-40db-9000-0a55-89d94a5ca4b3",