Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

SPO document library delegation not displaying documents in gallery



I have a Power App where I have a list form with a column called "Contract No".

For example the "Contract No" could be "LWCM-01-04-2018-208" where 208 equals the list ID number.


For each list item created I also have a folder automatically created in a separate document library.

Each folder uses the same name as the "Contract No" column so I would have a folder named "LWCM-01-04-2018-208".


The contents of each folder is displayed next to the form depending on which item is opened.


We've recently gone over 500 documents in the document library (at top level) even though each sub-folder for each contract has about 5 files in each. It was brought to my attention that the more recent contracts that had been created were not showing their associated files - these had been added into SharePoint but were not displaying in PowerApps.


It dawned on me that in PowerApps that in settings, the Data Row Limit was set to 500. After increasing this to 2000, the documents started showing.


Now, I admit I'm no Power Apps pro, and I'm still learning the platform. I'm a little stuck as whilst I've temporarily solved the problem. When we eventually pass 2000 documents added to the document library, the Power App will stop showing documents again. 

How can I setup delegation on the document library so that these documents continue to be shown?



Super User
Super User

Hi @sudosaurus 

We have some workaround to solve this issue which retrieves the documents multiple times and join together



  • Collects 2000 and store in a collection
  • Join the collections
  • Use Concurrent to improve performance



//Concurrent Request
        CustomerKey <= 2000
        CustomerKey > 2000 && CustomerKey <= 4000
        CustomerKey > 4000 && CustomerKey <= 6000





  • Now colMyRequests has all your documents
  • In this case, we have to know the maximum possible documents count, so that we can retrieve it multiple times


If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

Solution Sage
Solution Sage



The 2000 limit is the maximum amount of items powerapps can retrieve from sharepoint with one query. 


You can however get accurate results from large libraries, as long as you dont use queries that will return more than 2000 items.


To test this, I created a library with 67k files, a unique title, and some meta data that was shared between batches of files (for example, 74 files of the value 550921903 in Column x, which i can check by using the filter in sharepoint). In powerapps, when filtering the library for that value in column x, 74 items are returned as well.


If you just filter on folderpath (which is a native metadata field in powerapps for libraries) you should get results back without any issue 






Super User
Super User

Thanks for more information. We should not be having any issues when the filter query that result is less than 2000. So add some filters on the gallery screen to make sure to return fewer results.


Sample filter (Priority - Dropdown) and text search:

    {sData: 'Issue tracker'},
                Priority.Value = Dropdown1.Selected.Value
            'Date reported',


Sample Lookup (Brings specific record)

LookUp('Issue tracker', ID=SelectedId)


Post Prodigy
Post Prodigy

Hi @StalinPonnusamy and @KvB1 


Thanks for both of your responses.


This is the "Items" value for my gallery:

Filter(Contracts,'{Path}' = Concatenate("Contracts/",DataCardValue1.Text,"/"))


Where "Contracts" is the document library.


How would I add those filters into my current item value?


Just to get an idea of my app. On the left is the SharePoint list form and on the right is the folder that sits under the Contracts document library and then there is a gallery (Contract Documents) below this that shows the files for that specific contract.




Super User
Super User

You should be having some unique id for each record then

In this example, ID is a unique key for the record



LookUp(Contracts, ID=Gallery1.Selected.ID)



The right approach is to set a unique record id whenever you selected gallery


Set(SelectedId, ThisItem.ID)



On the form item property


LookUp(Contracts, ID=SelectedID)


ID - My datasource unique Id/key. Replace your unique key


Post Prodigy
Post Prodigy

I'm not sure where to put that in reference to what I already have?

With the approach you used as you mentioned, you have the problem where files showed again after setting limit to 2000?


What you could try is add a column to your library with a ContractID, index the column, and filter the library on that rather than on the folder

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.


New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,722)