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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue using a Gallery ...
Power Apps
Answered

Issue using a Gallery to display files in a Sharepoint Document Library

(1) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi.  We created a PowerApp to track our group projects.  I created a tab that will show the subfolders and files contained within a specific folder within our Sharepoint Document Library based on the project selected in a table within the PowerApp screen.  When I first set this up two weeks ago, the gallery was displaying both folders and files in my gallery; however as of Wednesday last week, my gallery will only display the subfolders and ignores any files that are within the Sharepoint Document Library Folder.  I've attached screenshots of the app and code and have copied the code below as well.

 

Table Onselect:

UpdateContext({varFolder: "Shared Documents/" & tblProjectList.Selected.'Project Team' & "/" & tblProjectList.Selected.Title & "/"});

 

Gallery Items:

SortByColumns(AddColumns(Filter('Team Documents','Folder path' = varFolder),"Foldersort",If(IsFolder=true,1,2)),"Foldersort",Ascending,"{Name}",Ascending)

 

Blue Test Table Items (visible in the screenshots): I removed the Sort incase that was causing the issue

Filter('Team Documents','Folder path' = varFolder)

*The blue table is a test table to display the results of the code used to populate the gallery as a secondary check while I was troubleshooting.  I can only submit three attachments so I didn't submit the screenshot with this code, but can if needed.

 

Is this a bug within PowerApps or is something missing from my code?

 

Thanks,

Todd

@Anonymous 

Sharepoint Document Library.jpg
Gallery Items.jpg
Project Table Onselect.jpg
Categories:
I have the same question (0)
  • v-monli-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Will the gallery show the files correctly using the Blue Test Table Items? What are the parameters like "tblProjectList", 'Project Team' referring to? Are they SharePoint list name and column names?

     

    Regards,

    Mona

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Mona.

     

    The Blue Test Table does not show the individual files either only the sub-folders (see attached screenshot).  "tblProjectList" is the name of the project table that is on the left side of the screen under the "My Projects" button.  This table displays the information contained in the Sharepoint List "Project List".  "Project Team" is a column within the "Project List" Sharepoint List.  In the reference code of the original post, the "Project Team" is "Applications" which corresponds to the "Applications" folder after the "Shared Documents/"

     

    Thanks,

    Todd

    Test Table Items.jpg
  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    I think that the reason that it doesn't show any files anymore is because there are too many files in the complete Document Library and the 'Folder Path' property is not Delegable. I had a similarly problem a while ago.

    If you add an extra text-column to you Document Library with, for example, the name ActualFolderPath and build a Flow which updates this column with the value of 'Folder Path' every time a new file is created, you can then use this column in you PowerApp instead of 'Folder Path'.

     

    Hope this helps you 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The first time you can give all the existing documents the correct value for ActualFolderPath with the Flow shown below.

     

    Create Folder Path.png

     

    This way you can test if this solves the problem. If it does, you need to make the Flow which I mentioned in the previous post. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous ,

     

    You were correct in that it was a delegable error.  When I changed my data row limit for non delegable queries from 500 to 2000, the gallery started working again.  Since that isn't a long term fix, I tried what you suggested by creating a new column titled "ActualFolderPath".  When I updated my code, this was delegable like you said; however it only worked for the subfolders.  The flow did not update the "ActualFolderPath" column for the individual files and so the individual files did not display.  Is there an additional step needed to display the individual files contained within the folder and not just the subfolders?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Strange that it only updated the folders and not the files. I had no more than 3000 files at that moment in the library and used the advanced options of 'Get files (properties only)' to fill in a 'Top Count' of 3000. Maybe that helps? See the picture below:

     

    Filter Query.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I just found out that the default 'Top Count' is 100 if you leave it blank (even if it says all, this is limited to 100). You can fill in a number between 1-5000. The max here is 5000 or 4999, I don't know exactly, but just fill in a little bit more than the amount of files in your library.

    When you have more than 5000 files in your library, you can fill in a 'Filter Query' which checks if the ActualFolderPath is empty so it will only get these files and you have to execute your Flow a couple of times (depending on how many files you library counts).

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous 

     

    Updating the 'Top Count' to 5000 did the trick.  The flow updated the 'ActualFolderPath' for both the files and the folders.  Everything appears to be functioning as I intended and displaying properly in the gallery.  Thanks for all of your help!

  • wyotim Profile Picture
    2,545 on at

    @Anonymous, today I was working on something similar to what @Anonymous posted and your solution came in quite handy! Thanks for posting it!

  • CU10021407-0 Profile Picture
    42 Season of Giving Solutions 2025 on at
    Uggggh ...... i figured out the problem and I knew it was going to be something extremely simple i overlooked.
     
    My data row limit was still set to 500 and that was apparently affecting it. after i changed it to 2000 it started working again.
     
    /face slap

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard