Skip to main content

Notifications

Community site session details

Community site session details

Session Id : x3ebmt8v9IRPVu1kfZl999
Power Automate - Building Flows
Answered

Updating SharePoint Page content SharePoint API

Like (0) ShareShare
ReportReport
Posted on 4 Jan 2023 11:31:40 by 862 Super User 2025 Season 1

Hi,

I want to post News items on SharePoint using PowerAutomate. As I am using different banners for different posts, I've chosen and succeeded in copying a selected template out of the templates to the site pages folder. This solves my earlier problem that custom created pages do not show the banner as a preview thumbnail. 

 

Now after copying the template, I would like to update the content with a new title and some new content. This is how far I got. 

RogierE_0-1672831615159.png

 

But it does not seem to update the title and page content to 'something'. Interestingly enough, the flow runs successfully, but does not update anything:

RogierE_1-1672831753044.png

Anyone has an idea on how to fix this? 

 

  • Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 04 Jan 2023 at 15:51:39
    Re: Updating SharePoint Page content SharePoint API

    Hi @RogierE,

     

    Properties like TopicHeader & BannerImageUrl are on the same level as the CanvasContent1 property. I see you are missing those in your payload. 

     

    Most of these methods are either in Microsoft Learn docs or you can reverse engineer them by manually editing the page and having a look at the payload in your Developer toolbar in the Network tab.

     

    I would also suggest to start having a look at the new Graph API pages methods:

    https://devblogs.microsoft.com/microsoft365dev/announcing-the-new-sharepoint-pages-api-in-microsoft-graph/

     

  • RogierE Profile Picture
    862 Super User 2025 Season 1 on 04 Jan 2023 at 15:09:59
    Re: Updating SharePoint Page content SharePoint API

    Thanks again. It worked, and I learnt a lot about the api. Is there any reference page where I could look up all the possible functions in the API like "checkoutpage" and "Publish" for any future coding challenges ? 

     

    One thing though: it did not solve my original problem, that the thumbnail seems to break when you manually change the Canvascontent1. 

    check out the screen shot of my News Webpart

    RogierE_0-1672844426792.png

    The "something" post where I used your procedure to change the content of the page misses a Thumbnail of the banner, whereas if i just copy the template and do not change the content, it stays. As you can see in the most recent post called "Template-***"

    Any idea's on that? Did I maybe break something with this SavePage body ?

     

    {"__metadata":{"type":"SP.Publishing.SitePage"},
    "Title":"something",
    "CanvasContent1": "[{\"controlType\":4,\"id\":\"a3205408-9b2c-4cc8-a5e2-db21c4142daf\",\"position\":{\"layoutIndex\":1,\"zoneIndex\":2,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":12},\"addedFromPersistedData\":true,\"innerHTML\":\"something\"},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true,\"isSpellCheckEnabled\":true}}]"}

     

  • Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 04 Jan 2023 at 13:54:02
    Re: Updating SharePoint Page content SharePoint API

    Hi @RogierE,

     

    Can you try a POST request with a checkout method just before the action with the SavePage? See if that makes a difference?

     

     

    _api/sitepages/pages(276)/checkoutpage

     

     

    And after the SavePage you could use another action with a POST request with the Publish method

    _api/sitepages/pages(276)/Publish

     

  • RogierE Profile Picture
    862 Super User 2025 Season 1 on 04 Jan 2023 at 13:45:09
    Re: Updating SharePoint Page content SharePoint API

    Thank you for your quick reply! Trying that option led to an error code: 

    RogierE_0-1672839823884.png

    It is a freshly copied page, and so no one could be editing it. And I tried adding a delay of 10 seconds, which sometimes helps, but it didn't work. Any other suggestions? 

  • Verified answer
    Expiscornovus Profile Picture
    31,648 Most Valuable Professional on 04 Jan 2023 at 13:20:01
    Re: Updating SharePoint Page content SharePoint API

    Hi @RogierE,

     

    Can you try the SavePage method with a POST request instead?

     

    URI

     

    _api/sitepages/pages(276)/SavePage

     

     

    Headers

     

    {
     "Accept": "application/json;odata=verbose",
     "Content-Type": "application/json;odata=verbose"
    }

     

     

     

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard
Loading started