8 Replies to “Extracting SharePoint Online page content and embedding the HTML in an email”

  1. Thanks for the article. But above is not working when we have web parts on page. Example i have added news web part and i am showing multiple news on it I am trying to send this page in email. Text content is coming in email but not web part content

    1. Hi Mihir,
      Unfortunately there’s lot more that makes up a news web part than static HTML which make it look the way it does on the SharePoint page (such as JavaScript and CSS). Perhaps you could use your flow to extract the text and make your own template by sending a HTML email?

  2. Thanks for your article.
    May i know if there is any way to get CanvasContent1 HTML content with CSS/Styles together? Seems the content is using CKEditor css but i cannot find the css link.

  3. Hi there, do you know if its possible to get the existing content of a page, then using savepageasadraft to update the existing page. I know its possible using inspect page source but is there a way to do it all in power automate?

    Many thanks

    1. Hi Will, yes that’s definitely possible. I touch on a bit on it in this article: https://sharepointcass.com/2021/04/01/sharepoint-online-rest-apis-part-iii-pages/.
      Basically, you will need to call the ‘Get page content’ API referenced in the above article. You can then manipulate the returned CanvasContent1 HTML by using Data Operations (https://docs.microsoft.com/en-us/power-automate/data-operations) to find and replace parts of your HTML. I know SharePoint can be quite picky about how much is changed on the page, so I would make the changes minor and not change too much of the HTML elements and structure. Then when the changes are done, you can run the ‘Save page as draft’ API with your modified HTML (it should be encoded so the HTML doesn’t interfere with the API call). Images should also be encoded in the Base64 format (this article can help with how to format images https://sharepointcass.com/2020/08/13/embedding-images-from-a-sharepoint-site-in-an-outlook-email/).

  4. Hello!

    Thanks so much for this article. 🙂 I am a Sharepoint/PowerAutomate newbie and I was wondering how you set the variable once you get CanvasContent1. Thank you!

Leave a Reply to SharePointCass Cancel reply

Your email address will not be published. Required fields are marked *