cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ell1990
Helper I
Helper I

How to view subfolders and files within a folder in a document library?

Hi all

 

I am a relatively new user to PowerApps and am trying to create an app that will allow users to navigate through a document library.  I have inserted a gallery into the canvas and connected it to the document library.  I then want to be able to select a folder and display the contents of it, in another gallery.

 

Any suggestions would be greatly appreciated.

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @ell1990

 

We can use Folder path to filter the gallery.

1. Set the Items property of left gallery:  Filter(DOCS,'Folder path'="DOCS/") , DOCS is the name of SP document library.

2. Set the Items property of right gallery: Filter(DOCS,'Folder path' = "DOCS/" & Gallery1.Selected.Name &"/" )

Further steps, set the following steps to set the visible of the right gallery.

1. Put UpdateContext({VarGal:false}) to OnVisible of screen

2. Set OnSelect of right arrow to If(VarGal = false, UpdateContext({VarGal:true}),UpdateContext({VarGal:false}))

3. Set Visible of the right property to VarGal

StoG_2.gif

Hope this can help.

Best regards,

Sik

 

View solution in original post

5 REPLIES 5
yashag2255
Dual Super User II
Dual Super User II

Hey @ell1990 

 

To get the first level of folders, you can use the below expression on Gallery1:
Gallery1 -> Items -> Filter(Documents, IsFolder = true && 'Folder path' = "Shared Documents/")
Please check if "Shared Documents" is the correct root path in your case.

To get the second level of folders, you can use the below expression on Gallery2:
Gallery1 -> Items -> Filter(Documents, IsFolder = true && 'Folder path' = "Shared Documents/"&Gallery1.Selected.Name&"/")

To get the third level of folders, you can use the below expression on Gallery3:
Gallery1 -> Items -> Filter(Documents, IsFolder = true && 'Folder path' = "Shared Documents/"&Gallery1.Selected.Name&"/"&Gallery2.Selected.Name&"/")

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

v-siky-msft
Community Support
Community Support

Hi @ell1990

 

We can use Folder path to filter the gallery.

1. Set the Items property of left gallery:  Filter(DOCS,'Folder path'="DOCS/") , DOCS is the name of SP document library.

2. Set the Items property of right gallery: Filter(DOCS,'Folder path' = "DOCS/" & Gallery1.Selected.Name &"/" )

Further steps, set the following steps to set the visible of the right gallery.

1. Put UpdateContext({VarGal:false}) to OnVisible of screen

2. Set OnSelect of right arrow to If(VarGal = false, UpdateContext({VarGal:true}),UpdateContext({VarGal:false}))

3. Set Visible of the right property to VarGal

StoG_2.gif

Hope this can help.

Best regards,

Sik

 

View solution in original post

I am having seemingly random results with some folders in gallery one showing files in gallery2 but then some folders not showing any files in gallery2. Looking at Sharepoint there seems no difference between the folders (contents are similar, e.g. PDFs) and the folders were both created automatically by another process (the same process). Any ideas on anything I maybe missing?

I want to do something similar but I think the issue here is delegation,  None of the commands are delegable as I think the text is stored in multiple lines of text.  So you can only find a max of 2000 (depending on your settings)

@v-siky-msft i had a question , if i wanted to build the same for lets say 3 Levels Example 
Folder-> Folder->Folder_>Files.

There might be a case where in some folders will not have subsequent folders but only files. will the folders then show files or not?

How can I do that?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (35,536)