SharePoint is all about document management. Therefore to get file content from a file must be something easy.

Well it is that easy that there are at least 3 methods of doing this.

  • Get file content action
  • Get file content by path action
  • Send an HTTP request to SharePoint action

In this post I’m looking at the first two options.

Both Get file content and Get file content using path actions look very similar and I would probably question why there are two actions for this.

Get file content twice

In the above action I selected the files that I wanted to read form the little folder icons at the right.

When I typed the url for both action however, I found that I got the following error:

Get file content failed

{
"status": 400,
"message": "Route did not match\r\nclientRequestId: 1dfab1da-028e-4761-b024-e8e5460146b0\r\nserviceRequestId: 1dfab1da-028e-4761-b024-e8e5460146b0"
}

Well, that is not pretty!

The get file content using path did still work. Then I thought about using the Get files and use the file identifier for the file instead and this works.

Get files added

This now shows the difference between the two options. When you use the get file content the url needs to have the spaces and slashes in the url encoded.However strangely enough this seems to only be the case when you try to use dynamic content or manually supply the file details. As we saw earlier the /Shared Documents/Document.docx worked perfectly fine when I selected the file manually. The other strange thing I noticed is that the leading slash has disappeared when when the file identifier is selected from the Dynamic content.

 

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

4 thoughts on “Get file content x2 from SharePoint in Microsoft Flow”
  1. I want to create a flow that, when a file is created the file gets sent via e-mail. How do I do that while working around this bug. I get 404 probably due to the URL not being encoded correctly.

  2. Does the third option – “Send an HTTP request to SharePoint” – allow the 100MB limit to be bypassed? If so, what parameters need to be submitted?

    1. To answer my own question: the URI is _api/Web/GetFileByServerRelativeUrl(‘[path-goes-here]’)/OpenBinaryStream, but the 100MB limit remains.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading