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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Sorting to overcome 5,...
Power Automate
Unanswered

Sorting to overcome 5,000 Item Limit

(0) ShareShare
ReportReport
Posted on by 674

I have a Flow that operates on a SharePoint library with more than 5,000 items (the dreaded 5,000 limit has been exceeded). One of my first actions is scanning the library using a Get Files (Properties Only) action, which needs to search the entire library, then filter based on one column. Another factor is that I need to sort/order the files based on one of the columns, so that they are retrieved, and eventually merged into a single file, in the correct order. This all works well by using the oData query (just filter the items based on matching a certain value in a column), then an order by query (in this case, I need to order ascending by a column called Doc_Type).  The problem is that now the library will not be scanned for all 5,000 + items due to the limit.  I have to set top count at 4,999.  One nice solution would be to reverse the sort order by using ID desc (descending order of Item ID, or more recent first), in which case, I would solve my issues, because I am typically only dealing with the most recent 500 to 1000 files.  But when I switch to sorting by ID descending first, then Doc_Type ascending, my documents will be retrieved out of order, and later passed into a merge array out of order.  Filter arrays and other actions cannot sort.

 

Are there any solutions to either overcome the 5,000 limit, or to do a second sort after the Get Files (properties only) action, to re-sort the filtered list of items by Doc_Type ascending before passing into the merge array?

 

Thanks for any help on this.  Screenshots below:

Flow2.jpg

 

Flow3.jpg

 

Flow1.jpg

 

 

 

Categories:
I have the same question (0)
  • 55552 Profile Picture
    674 on at

    Screenshots were out of order.  The bottom screenshot should be at the top.  And not shown, but there is a trigger at the the beginning that starts up the Flow when an item is modified in a separate SharePoint list. Then data from that Item is stored in a variable and used in the Flow.

  • Verified answer
    efialttes Profile Picture
    14,756 on at

    @Runner55552 

    Not sure if this workaround from great John Liu can fit your needs.

    http://johnliu.net/blog/2018/12/how-to-implement-sort-with-microsoft-flow-in-3-actions-within-a-loop

    So first sort is applied on the Get items via ODATA, second sort is applied via this workaround

    Hope this helps

  • 55552 Profile Picture
    674 on at

    I accepted the proposed solution from John Liu after reviewing it, and also receiving the same recommendation independently from another source.  I have not tested it yet in my sandbox, but plan to shortly. Conceptually, it looks like it should work.  Thanks!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard