Forum Discussion

GavinK9's avatar
GavinK9
Copper Contributor
Dec 04, 2024

Flow to replace SharePoint site page text web part content from form entry

I wish to trigger a flow from a form and use a response value to replace the text values in a text web part in a specific page in "Site Pages".

I have tried 2 options but neither of them work.

I had a look at this method but I found it confusing plus I would not be able to share/email the page because of the dynamic nature of the content.

I am getting a error on the final action (version 1) or having the content canvas completely removed including canvas header (version 2).

TRIGGER (both options): When a MS Forms response is submitted

ACTION 1 (both options): Get response details
ACTION 2 (for option 1): Get Digest Token (via Send an HTTP request to Sharepoint (POST))
ACTION 3a (option 1): Update Web Part (via Send an HTTP request to Sharepoint (PATCH))
-- RESULT: Action 'Send_an_HTTP_request_to_SharePoint_-_Option_1' failed: Cannot find resource for the request webparts. clientRequestId: 093cb580-33ec-45b8-a305-f0ccd16e5405 serviceRequestId: 00616aa1-b034-4000-219c-1d33e02fd756 
ACTION 3b (option 2): Update CanvasContent1 (via Send an HTTP request to Sharepoint (POST))
-- RESULT: No change to web part and page not modified.

8 Replies

  • michalkornet's avatar
    michalkornet
    Iron Contributor

    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.

    • alokkumar's avatar
      alokkumar
      Copper 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.

      • michalkornet's avatar
        michalkornet
        Iron 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

  • GavinK9's avatar
    GavinK9
    Copper Contributor

    I forgot to include this link of the other method: https://collab365.com/how-to-add-text-to-any-part-of-a-sharepoint-page-using-power-automate/

Resources