Get files using REST API

So often I hear complaints about SharePoint actions in flow not working. In this post I will look at the complication when you try to get all files in a folder in SharePoint.

But actually you only really need one action. Just make sure that you use the right action. Get files may look like the right action, but the Send an HTTP request to SharePoint can do so many things and it is easy to configure, if you know how to.

Get all files from a folder

Today I tried to get all files in a folder in SharePoint library. At first you might try to do this using the following flow with a Get files (properties only) action.

You might even have figured out that the {FullPath} field contains the path to the folder holding the files that you are interested in. But before you know you will have spend hours trying to make this work.

Get all files using get files action

The underlying API uses a REST API call and the fields with the { … } simply give bad request error messages.

Send an HTTP request to SharePoint

As so many times the Send an HTTP request to SharePoint will give the easy solution. The SharePoint REST API documentation will quite quickly give you the right syntax.

Get files using REST API

The REST API url that I’ve built up is:'/Shared%20Documents/testfolder')/files

Did anybody say that REST API calls are complicated?

See also

Today 19 March 2020, I noticed an update to the Get Files action, see my post about these changes helping you filter by folder in the get files action.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using

15 thoughts on “Get all files in a SharePoint folder using Power Automate”
    1. Hi Ariel,

      I am aware of that action. It is however more complicated to make it work when you include subsite, document libraries with spaces and folder and sub folder. With this HTTP request action it’s just a simple URL that needs to be configured.

      Also the Send an HTTP request to SharePoint is so much easier to configure when you want flows that can be moved between environments.

      One of my clients (a citizen developer) battled for 2 hours with the List Folder action. The action in the post is a very easy to configure REST API call.

  1. OK…so how do you [Apply to each] through that object payload to copy each file to a new folder (document set)? I did a [Parse JSON] but it is still an object and [Apply to each] wants an array. And [List Folder] is a PITA.

  2. I did manage to get that info by doing a Parse JSon…then a Apply to Each…and I put an array variable in that and it did cycle through the files so I could copy…thanks for putting me on the right path!

  3. From what I can tell, the /files command only gets .. files.

    It does not return any subfolders, or document sets, so it’s incomplete as a replacement.

    1. Hi Christopher,

      Are you getting any errors back? When you run the flow what does the Send an HTTP Request return? any errors?

      Can you post the url? Feel free to use the chat on this site.

  4. HI Pieter. Great stuff, thank you.

    Can you help further? These HTTP calls don’t seem to read into subfolders, correct?

    I am trying to move a folder, with files and subfolders, from a SharePoint doclib to a OneDrive folder.

    It’s looking like I have to build a loop to traverse the tree, right? I thought “Get Files (properties only)” or “List Folder” would work for me, but having no luck. The Get Files consistently returns nothing [], with no errors and List Folder doesn’t recurse down into sub folders. The library is quite large (140,000 items) in case that matters. Thoughts?

    Thank you,

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

%d bloggers like this: