Notifications
Announcements
I'm creating an app that is connected to a document library. The app navigation bar is a list of all the folders in the library. Once a folder is clicked I'd like for all the documents in that library to be displayed in a dynamic gallery on the page. I've gotten both the folder list created and a general gallery that shows all listings that are not folders. What I need assistance is filtering the results to show only for a specific folder.
Hi @robethom ,
You need to put the folder name in the metadata of the SharePoint Library, then you can do a filtered gallery on this value. I have a SharePoint Designer 2013 workflow below that automatically assigns the first two levels of folders (you could easily extend this) into two fields in the library as soon as a document is filed. You will need to get familiar with Workflows, but they are very easy once you have a bit of practice.
Happy to give you further guidance if you want to go down this track.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @robethom
We can use Folder path to filter the gallery, please try this:
1. Set the Items property of left gallery1:
Filter(LibraryName,IsFolder)
2. Set the Items property of right gallery2:
Filter(LibraryName,'Folder path' = "LibraryName/" & Gallery1.Selected.Name &"/" )
Hope this can help.
Best regards,
Sik
This looks to be exactly what I'm looking for. I get no error when I set the function(fx) for gallery2. However, when I test, it never shows documents within the folder. Does it matter that I'm using the modern design in SharePoint 365. Does this require the classic library interface?
Thanks @v-siky-msft ,
Something I did not think of although we have been using the workflow for a long time. This will only work on one level of folders?
Could you share some screenshots as follows? What is the 'Folder path' field of documents?
The secondary gallery is filtered based on 'Folder path' field, please ensure the folder path is correct. Please check this:
the code #"F1/" & Gallery2.Selected.Name &"/"# returns "F1/Image Folder/", it means the gallery only displays documents that 'Folder path' field is 'F1/Image Folder/'.
You can use a gallery to show the 'Folder path' field of each document to determine whether the filter conditions of the filter function above are met.
Sure. I've included my screenshot of how I have the filter setup for my display gallery. I had the folder list print out the 'folder path' and it seems to show the correct path. Am I overlooking something simple?
Please ensure the Text property of Label is ThisItem.'File name with extension'.
You can debug the issue by hardcoding the folder path into Filter function. Please try as shown below to check if there are any documents shown in the gallery.
If not, please consider removing the SharePoint Library connection and re-add to check again.
Made some tweaks after hardcoding it into the filter and it looks to be working thank you for your help. It's been a life saver.
Thanks @v-siky-msft !
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 796 Most Valuable Professional
Michael E. Gernaey 327 Super User 2025 Season 2
Power Platform 1919 268