11 Replies to “SharePoint Online REST APIs (Part III): Pages”

  1. Hi,

    Firs of all thanks for the synthesized iformation. I’m trying to create a page with Power Automate using the last two endpoints in your list. First one is to create the page and the second to populate the page with the data. The flow goes without errors but the end result is a copy of the template page with chaged name. The content is unchanged. More info about my problem can be found here https://powerusers.microsoft.com/t5/Building-Flows/Send-http-request-to-SharePoint/td-p/1323311. Any suggestions are welcome. Thanks in advance.

    1. Hi, thanks for reading! API calls can be tricky to troubleshoot (especially when it’s saying everything is fine). I’ve had issues in the past where a page wouldn’t change if my HTML was not right (SharePoint can be picky about the littlest change). I have a post that I need to write about this process, however, it’s quite complicated and frankly I just keep putting it off. I noticed that you are not referencing a template file in your code, but appears to be another SharePoint page. Also are you going to the Developer Tools in your browser and getting the code from there? This post outlines the process and might be helpful if you haven’t seen it before (step 3 outlines the Dev Tools step): https://www.c-sharpcorner.com/blogs/automate-modern-sharepoint-page-creation-using-power-automate

  2. Hi again,

    I have read this article before and it is quite similar to the youtube video I posted in the other topic. Today I tried to run the request manually with the help of little bit of JS. In the console I got the error that the security validation of the page was invalid. The recommended approach in such cases is to add the X-requestdigest property in the header. However I have no idea how to do that in power automate.

    1. So I was able to get the flow working with static hard coded content, but not with dynamic. It turns out that I was using wrong ID and that was the reason why nothing was changed. Now the problem is how to get the content from the word file and put it on the page. The PageContent option from GetFileContent is taking too much time and eventually the flow fails because the session is ended. Any Ideas why this happens?

      1. As far as I’m aware, Power Automate returns the data from Word as binary. Depending on how big or complicated your document is, this might cause the action to time out. To read a document, you would most likely need to use the AI tools in Azure.
        https://azure.microsoft.com/en-us/services/form-recognizer/#overview
        https://powerusers.microsoft.com/t5/Using-Flows/Is-there-any-method-to-red-content-of-word-and-pdf-file-from/m-p/284166/highlight/false#M6914
        EDIT: I found this post which explains how you can get the text. It’s not straight forward, but looks like you might be able to extract the text by XML elements, then manipulate it from there: https://www.tachytelic.net/2021/05/power-automate-extract-text-from-word-docx-file/

  3. Thank you so much for this valuable information. Right now I’am being able to extract the information and all the flows pass except the last one where I am putting the output of the compose into the request body and want to save the page as a draft. Is it possible because the output is array and this messes up the last step? The word file I’m using for testing has only one line of text, so there is not so much info.

  4. If anyone is interested the output of the compose expression should be represented with join(outputs(‘Compose’),’;’) so that it can be put in the body of the request.

Leave a Reply

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