cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ThomH
Frequent Visitor

Listing Files in a Document Library in Sharepoint With Powerapps App

I'm looking to use a gallery or data table (I've tried both) to display a listing of files in a Sharepoint document library in a canvas app. This feature was originally announced in March 2019. I've reviewed the documentation and the other questions asked within the community (this post was helpful), and have had success, however it only lists a handful of the files (12 qty) versus the whole list of files.   Here is a variation on what I've used in my gallery (also similarly attempted in a data table). I've changed directory names, of course:

 

Filter(Documents, IsFolder=false&&'Folder path' = "Shared Documents/Directory to View/")

 

I've reviewed the files, and there is nothing odd about them, and they have the same structure and extension (.csv) as the others. I'm not sure if I'm doing something in correctly in the above snippet, or if there some known limit to the number of files that can be listed.  Some extra information that may be helpful:

  • Users of the app also have full access to the SP site
  • There are no spaces or blanks within the file and directory names, to avoid issues (e.g. Column_x0020_Name)
  • The file names are unique
  • All files are .csv
  • There is one subdirectory within this directory (I'm not sure if that would be a factor, we're not trying to view it)
  • I am not seeking to list or access subdirectories, just the files

Thanks for any guidance or insight.

4 REPLIES 4
Pstork1
Dual Super User III
Dual Super User III

If you are trying to list all the files then the second part of your formula isn't necessary.  That will limit the files listed to only the ones in that specific subdirectory.  It will also filter out any files from child directories below the subdirectory.  If you want to list all the files starting at a particular subdirectory and below use the following.

 

Filter(Documents, IsFolder = false && StartsWith('Folder path', "Shared Documents/directory to view"))

The one other potential problem is that the IsFolder check is non-delegable so this filter will only apply to the first 500 (2,000 if data row limit is extended) files in the library.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
ThomH
Frequent Visitor

Thanks so much for the reply!I am trying to limit to the files to "directory to review" (subdirectory) and do not want to include items in a child directory. 

 

(I should mention, "directory to view" is a fictional name for posting purposes.)

 

With your formula and mine, it still only shows 12 files, whereas there are 21 in "directory to review".

 

But your mention of a child directory got me thinking - since there was one.  I removed the child, to see if it was impacting it for some reason. While doing so, I renamed the files in the child, and placed them in the main directory ("directory to view"). Those files then appeared, making it 15 that are viewable.  So now I could see that I had some files that were excluded for some reason. All of these .csv files are created via a Power Automate Flow, and are automatically saved in the directory weekly (this app was created to monitor the backup process).  The ones that are showing - as it turns out - were modified by me since they were manually moved to the directory when I set up the process. The moving of the child directory files was the same case.  I'm now wondering if there is some issue of permissions, though I cannot see a difference in the files. 

Pstork1
Dual Super User III
Dual Super User III

Assuming the Power App is running with your security context if you can see the files in SharePoint they should also show for you in Power Apps.  I have not been able to duplicate your issue. All the files in the subdirectory show for me.  But I haven't actually tried with a .CSV.  It should either be permissions or maybe that the connector is filtering out certain types of files.  If you rename one of the .CSV files to have a different extension does it then show up?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
SergiPino
Regular Visitor

hi,

I think you're running into a delegation issue. Unfortunately all fields seem to be non delegable in the Documents folder. So probably the 12 files you see are among the first 500 (or 2000) rows/files in your Sharepoint. Due to the delegation row limit you can't see any file beyond the limit.

Even StartsWith than uses to be delegable with all Lists in SharePoint is not delegable when used in the Documents file list.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,510)