Skip to main content

Notifications

Power Platform Community / Forums / Building Power Apps / View SharePoint Librar...
Building Power Apps
Answered

View SharePoint Library in a Gallery using name of gallery items

Posted on by 10
I'm trying to populate a gallery in powerapps with any documents in a SharePoint library depending on the Project and Task that have been selected.

I've set a variable for the main folder and that's working fine and if I want I can set an icon so that it keeps drilling down but that's not what I want. 
 
The folder structure goes; Projects Folder > Project Folder (multiple folders all with matching project name as in SharePoint List) > Task Folder (all matching with the tasks in the SharePoint list).
 
I have a task card that when selected a Pop up appears displaying all of the information for a task and within that I also want to display any documents that relate to that task.

If I hard code it, it works perfectly. I can hard code the variables and it works,  however when I try to add the folder name in using a variable based on the item selected it does not work i.e. Set(varTaskFolder, ThisItem.TaskName). Same thing for the Project Folder. 
 
So hard coding it's Filter('Projects Folder', 'Folder path' = varMainFolder (this works as I can hard code it: "Projects Folder/") & "Project 1/Task 1/". If however when I select the task in my task gallery and set a variable as above (Set(varTaskFolder, ThisItem.TaskName)) and use the varible I have for the Project and grab the project name for it (Set(varProjectFolder, varProjectItems.Title)), so it all looks like this:
 
Filter('Projects Folder', 'Folder path' = varMainFolder & varProjectFolder & "/" & varTaskFolder  & "/"), I get nothing. Even though varProjectFolder = Project 1 and varTaskFolder = Task 1. I've added them all into a text label and they give me the correct text. I've even copied that text into the formula and it works.
 
I've also tried adding the  & "/" into the variables and that does not work either.
 
Can anyone explain where I'm going wrong.
  • CU06090422-0 Profile Picture
    CU06090422-0 10 on at
    View SharePoint Library in a Gallery using name of gallery items
    So it turns out I was doing it the right way all along. Just a little bit of PEBKAC. There was a slight spelling mistake in one of the folder names which meant it did not match the one of the titles in the app correctly. This is what happens when you are slightly vision impaired.
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 140,719 on at
    View SharePoint Library in a Gallery using name of gallery items
    Firstly, you are dealing with a non-Delegable query here, however assuming your Library file numbers are under your Data Row Limit, you should be able to see it. Also I assume you have all the / characters in the right place (particularly the first one), so if you put this in a Label
    varMainFolder & varProjectFolder & "/" & varTaskFolder  & "/"
    you would see the complete correct path ? As I noted above, it should work, however try this (as well as confirming the assumptions)
    With(
       {_Path: varMainFolder & varProjectFolder & "/" & varTaskFolder  & "/"},
       Filter(
          'Projects Folder', 
          'Folder path' = _Path
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 140,719

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,355

Leaderboard