web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

List Folder With around 65000 Sub Folders In It

(0) ShareShare
ReportReport
Posted on by 68

Have a document library that contains around 65000 folders in it. I'm trying to use the 'List Folder' PowerAutomate functionality to list the folders in the library, as later on in the automation I'm using it to compare names. When I run it though, after about 10 mins of running, I get the Bad Gateway error and it stops it. Works fine with less folders in the library. Does it timeout, if so can I extend the timeout time, or are there any limitations how many items should be in the library to list them?

I have the same question (0)
  • alrezac Profile Picture
    on at
    Re: List Folder With around 65000 Sub Folders In It

    Hi,

     

    You are for certain limiting a timeout. I don't think there is a limit on the action itself. I think what is happening is the action itself it running for so long in flow that it is timing out. You might be able to get the action to run faster by turning on pagination but its still not guaranteed to work since 65,000 folders is a lot of folder that needs to be sorted through.

     

    Regards,

     

    Alex

     

    -------

     

    Community Support Team _ Alex Rezac
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • benny_blanco Profile Picture
    68 on at
    Re: List Folder With around 65000 Sub Folders In It

    Hi Alex @alrez , thank you for that. Is there any other connector, non paid one, or any other solution I could use to get all folder names having in mind the large number of folders in the library? I need to compare the result with a file name and if it finds it, to move that file in the matched folder. And for that matter I need it to get all folder names. Thank you!

  • Paulie78 Profile Picture
    8,418 Moderator on at
    Re: List Folder With around 65000 Sub Folders In It

    I would consider using PowerShell to get the list of folder names, and then use the output from PowerShell as the input for your flow (or just do whatever it is you want to do completely in PowerShell).

  • Verified answer
    benny_blanco Profile Picture
    68 on at
    Re: List Folder With around 65000 Sub Folders In It

    I came up with a workaround instead of PowerShell. As the List Folder option, which is really the needed one, doesn't work with so many items and timesout giving the Bad Gateway 502 error, I managed to make it somehow work with the get items option. For that though, you have to input in the advanced options to list 5000 items (which is the maximum count for that action), then filter it to look for certain views. And I created views to filter only items starting with certain letters from the alphabet, just to show items starting with A, B letter, C, D etc. That is working so far for me.  

  • Paulie78 Profile Picture
    8,418 Moderator on at
    Re: List Folder With around 65000 Sub Folders In It

    @benny_blanco that was a good idea, you could probably do that in a for each loop and get a union of the results to make it faster/cleaner.

  • benny_blanco Profile Picture
    68 on at
    Re: List Folder With around 65000 Sub Folders In It

    Exactly

  • rodneyp Profile Picture
    6 on at
    Re: List Folder With around 65000 Sub Folders In It

    @benny_blanco  Can you share a picture of how you got this to work.. i'm trying to achieve a similar thing but not sure how you got a round the 'List Name' as a folder store doesn't have a list name (or not that i can find)..  any help would be great! 

  • KarlH Profile Picture
    31 on at
    Re: List Folder With around 65000 Sub Folders In It

    @rodneypand @benny_blanco - I too noticed "List Folder" doesn't return items restricted to a View, whilst "Get Items" doesn't allow me to select a Document Library, and only allows List selection. What's the workaround for limiting "List Folder" to only return folders in a View?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 722 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 461 Moderator

#3
developerAJ Profile Picture

developerAJ 283

Last 30 days Overall leaderboard