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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Displaying files in a ...
Power Apps
Answered

Displaying files in a Sharepoint Document Library (dynamically)

(0) ShareShare
ReportReport
Posted on by 195

Hi

Can someone advise please on the best way to display a list of files that appear in a Sharepoint document library?

The folder location will be dependant upon the screen the user is on at the time, so I will have the full folder path required, but how do I refresh a list (gallery) on screen to show the list of the files for that gallery?

For example, in the structure below, I would need to display in the gallery the files in folder structure 2019 > Test1 > Dept2

 

Many thanks - Paul.

 

Example Folder Structure:

 

  • 2019
    • Dept1
      • File1
      • File2
    • Dept2
      • File1
      • File2
    • Test1
  • 2020
    • Dept1
      • File1
      • File2
    • Dept2
    • Etc etc
Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Hi @PJBruen ,

    Try this in a gallery

    Sort(
     AddColumns(
     YourLibraryName,
     "Folders",
     'Folder path'
     ),
     Folders
    )

    Your field Folders will display the path.

     

    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.

     

     

  • v-yutliu-msft Profile Picture
    on at

    Hi @PJBruen ,

    Hi @PJBruen ,

    Do you want to display folders and files in the format that you want?

    Please notice that: you could insert a gallery inside a gallery, but it's not support to insert a gallery inside a nested gallery.

    So in the nested gallery, I suggest you use a list box to display file names.

    I've made a similar test for your reference:
    1)my library is named aaa.

    2)insert a gallery1, set its Items:

     

    Filter(aaa,IsFolder,'Folder path'="aaa/")

     

    10291.PNG

     2)insert a gallery inside this gallery1

    set the nested gallery's Items:

    Filter(aaa,IsFolder,ThisItem.'Link to item' in 'Link to item',Not('Link to item'=ThisItem.'Link to item'))

    10292.PNG

     

    3)insert a listbox in gallery1

    set listbox's Items:

    Filter(aaa,!IsFolder,ThisItem.'Link to item' in 'Link to item')

    10293.PNG

     

     

     

    Best regards,

  • PJBruen Profile Picture
    195 on at

    @WarrenBelz 

     

    Sorry for the delay - been on leave. 

    Thanks for the suggestion.

     

    This is currently failing for me at the moment. Are you able to point me in the right direction please?

    The document library used as the data source for the gallery is called 'Documents' and the contents of lblFolderPath.text is created from a variable, which currently has the value of '2019/2019 - BES/Treasury/Business Assumptions'

     

    So the full Items formula I currently have is:

    Sort(AddColumns(Documents, lblFolderPath.text, 'Folder Path'), lblFolderPath.text)

     

    The error is saying that the argument 'lblFolderPath.Text' is invalid, expected a text literal......but I'm not clear what it really wants here.

     

    Are you able to advise where I'm going wrong please?

     

    Thanks

    Paul.

     

     

     

     

     

    Sort(
     AddColumns(
     YourLibraryName,
     "Folders",
     'Folder path'
     ),
     Folders
    )

     

  • PJBruen Profile Picture
    195 on at

    @WarrenBelz 

    Hi again

     

    Thinking about the requirement, would it also be possible to open the file selected on the gallery?

  • PJBruen Profile Picture
    195 on at

    Hi @v-yutliu-msft 

    Thanks for your reply. I'll test your method as well as the one that @WarrenBelz  has suggested. Unfortunately, I'm not getting very far with either at the moment (it's a bit of a learning curve)... 

     

    Basically though, I have:

    • a Sharepoint document library named @document'
    • a label 'lblFolderPath_1' containing the full path (eg. '2019/2019 - BES/Treasury/Business Assumptions/')

    What I would like to achieve is that the gallery shows each of the files (there should be no further sub-folders at this stage) for the folder path. At present, the following code is not displaying anythingfor the first Gallery on the ITEMS property.

     

    Filter(Documents, IsFolder, 'Folder path'="Documents/")

     

    Here's a view of the Sharepoint site, which may help.

    PJBruen_0-1604326578122.png

     

    Any ideas where I'm going wrong?

     

    Many thanks, Paul

     

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Hi @PJBruen ,

    I am getting a little lost on your requirements here, but I will tell you what I do to manage documents and this might help. I have the folder names (two levels presently) in fields in the item's metadata. I actually have an old-fashioned SharePoint Designer 2013 Workflow doing this when a document is filed. A number of the Libraries have over 10,000 items.

    I then connect the Library as a data source and have fully delegable filters to show any document list in a gallery and then open it with Launch(ThisItem.'Link to item'). You can also view a preview of the document of a number of file types in an image control with ThisItem.'[Thumbnail}'.Large

     

    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.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard