Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Manipulate the CanvasContent1 value with REST API

(0) ShareShare
ReportReport
Posted on by 4

Hi !

I am currently strugling to update the  CanvasContent1 html of a page USING the sharepoint  REST API;

I tried the savepage method , but it return null without altering my page .

Any ideas ?

 

 

 

{
 "__metadata": {
 "type": "SP.Publishing.SitePage"
 },
 "CanvasContent1": "[{\"controlType\":4,\"id\":\"ed2476c7-994a-4a07-a322-8afe873c05f2\",\"innerHTML\":\"<p>Hello world in a Text Web Part from Power Automate!<br></p>\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":0.5,\"sectionFactor\":8,\"layoutIndex\":1},\"addedFromPersistedData\":true},{\"controlType\":3,\"webPartId\":\"c70391ea-0b10-4ee9-b2b4-006d3fcad0cd\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8},\"id\":\"5f80a41e-a354-4bdf-9b21-42539ba00d98\",\"addedFromPersistedData\":true,\"reservedHeight\":127,\"reservedWidth\":776,\"webPartData\":{\"id\":\"c70391ea-0b10-4ee9-b2b4-006d3fcad0cd\",\"instanceId\":\"5f80a41e-a354-4bdf-9b21-42539ba00d98\",\"title\":\"Quick links\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{\"title\":\"Quick links\",\"items[0].title\":\"\",\"items[1].title\":\"\"},\"imageSources\":{\"items[0].rawPreviewImageUrl\":\"\"},\"links\":{\"baseUrl\":\"\",\"items[0].sourceItem.url\":\"\",\"items[1].sourceItem.url\":\"\"},\"componentDependencies\":{\"layoutComponentId\":\"706e33c8-af37-4e7b-9d22-6e5694d92a6f\"},\"customMetadata\":{\"items[0].rawPreviewImageUrl\":{\"fixedWidth\":100,\"minCanvasWidth\":32767}}},\"dataVersion\":\"2.2\",\"properties\":{\"items\":[{\"sourceItem\":{\"itemType\":2,\"fileExtension\":\"\",\"progId\":\"\"},\"thumbnailType\":3,\"id\":2,\"description\":\"\",\"altText\":\"\",\"rawPreviewImageMinCanvasWidth\":32767},{\"sourceItem\":{\"itemType\":2,\"fileExtension\":\"\",\"progId\":\"\"},\"thumbnailType\":3,\"id\":1,\"description\":\"\",\"altText\":\"\",\"rawPreviewImageMinCanvasWidth\":32767}],\"isMigrated\":true,\"layoutId\":\"List\",\"shouldShowThumbnail\":true,\"hideWebPartWhenEmpty\":true,\"dataProviderId\":\"QuickLinks\",\"listLayoutOptions\":{\"showDescription\":false,\"showIcon\":true},\"imageWidth\":100,\"buttonLayoutOptions\":{\"showDescription\":false,\"buttonTreatment\":2,\"iconPositionType\":2,\"textAlignmentVertical\":2,\"textAlignmentHorizontal\":2,\"linesOfText\":2},\"waffleLayoutOptions\":{\"iconSize\":1,\"onlyShowThumbnail\":false},\"webId\":\"\",\"siteId\":\"\"}}},{\"id\":\"emptySection\",\"position\":{\"zoneIndex\":1,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4},\"addedFromPersistedData\":true},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true}}]",
 "PageRenderingState": {
 "canvasState": {
 "selection": {
 "control": {
 "type": 3,
 "id": "5f80a41e-a354-4bdf-9b21-42539ba00d98"
 },
 "zoneIndex": 1
 }
 }
 },
 "BannerImageUrl": "",
 "Title": "Home"
}

 

 

 

Capture.PNG

  • eduardoperez1 Profile Picture
    2 on at
    Re: Manipulate the CanvasContent1 value with REST API

    It is posible to manage rich text in the innerHTML? I want to put a multiline text like this "<div class="ExternalClass87437C01C8C84763A84BE26D1D14F642"><div style="font-family&#58;Calibri, Arial, Helvetica, sans-serif;font-size&#58;11pt;color&#58;rgb(0, 0, 0);"><span style="color&#58;black;">​avdcsdv&#160;<a href="https&#58;//codebeautify.org/html-to-text-converter">HTML to TEXT Converter Online tool (codebeautify.org)</a></span><br></div></div>" but it breaks...

  • demipoulpe Profile Picture
    4 on at
    Re: Manipulate the CanvasContent1 value with REST API

    Thanks @Expiscornovus , It works for me with savepageasdraft  , then publish the page  !

  • Verified answer
    Expiscornovus Profile Picture
    32,140 Most Valuable Professional on at
    Re: Manipulate the CanvasContent1 value with REST API

    Hi @demipoulpe,

     

    As far as I am aware that is a normal response for the SavePage method (it is a Status Code 200). I believe the response body simply doesn't included any details, that's all 😁

     

    Have you checked the content on your page or the version history and don't you see your changes?

     

    I would also suggest to Publish the item directly after the SavePage request btw.

     

    1. Below is an example to demonstrate that I use a SavePage get the same 200 status code with a null response.

     

    normalresponse.png

    2. As you can see the page did change though 

     

    normalresponse_savepage.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1