cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
underwt
Level: Powered On

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

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

@jbarkerag 

1 ACCEPTED SOLUTION

Accepted Solutions
QJappie22
Level 8

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

Hi @underwt,

 

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 🙂

View solution in original post

9 REPLIES 9
Community Support Team
Community Support Team

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

Hi @underwt ,

 

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 Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
underwt
Level: Powered On

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

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

QJappie22
Level 8

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

Hi @underwt,

 

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 🙂

View solution in original post

Highlighted
QJappie22
Level 8

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

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. 

underwt
Level: Powered On

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

@QJappie22 ,

 

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?

QJappie22
Level 8

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

Hi @underwt,

 

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

QJappie22
Level 8

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

Hi @underwt ,

 

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).

underwt
Level: Powered On

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

@QJappie22 

 

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!

Super User
Super User

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

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 385 members 6,486 guests
Please welcome our newest community members: