cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PJBruen
Helper III
Helper III

Displaying files in a Sharepoint Document Library (dynamically)

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
1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

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.

 

 

View solution in original post

6 REPLIES 6
WarrenBelz
Super User III
Super User III

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.

 

 

View solution in original post

v-yutliu-msft
Community Support
Community Support

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

 

@WarrenBelz 

Hi again

 

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

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

 

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.

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (94,296)