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

Displaying document folder that matches title of SharePoint list item

Hi,

I am still fairly new to PowerApps and don't have a development background.

 

On my app below, I have a flow that creates a folder in a document library named exactly the same as the "Contract Ref" column.

 

I want to be able to browse this folder within a gallery when viewing the SharePoint item in my canvas app (this is the grey section on the right!)

 

Out of the box if I have the Items function set to "Contract Documents", this lists all folders however I only wish it to display the documents that are in the same folder named as the Contract Ref.

 

Can anyone help?

 

ContractUI.png

 

2020-06-15 17_00_14-Window.png

14 REPLIES 14
Community Support
Community Support

Hi @sudosaurus :

Do you want to browse the files in the specified folder?

Please try this code:

 

Filter(
    'Contract Documents',/*your library*/
    'Folder path' = LookUp(
        'Contract Documents',
        Name = "XXXXX" /*Specify the name of the folder*/
    ).'Full Path' & "/"  /*Get the specified path*/
)

 

1.JPG

If you still have any question,pleas don't hesitate to let me know.

Best Regards,

Bof

Hi @v-bofeng-msft 

 

I have a column called "Contract Ref" (based on the ID column) - when an item is created, a folder with the same reference is created in the "Contract Documents" document library. Therefore, when the canvas form opens, I wish for this folder to display the files contained in it.  It is a different set of files depending on the list item that is opened.

 

filter.png

@v-bofeng-msft any ideas?

Hi @sudosaurus :

I don't understand what you mean, could you explain it in detail?

In addition,maybe this link will help you a lot:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Gallery-for-admin-user-in-powerapp/m-p/58848... 

Best Regards,

Bof

@v-bofeng-msft 

 

  • I create a list item which has a custom reference field set as: LWCM-2020-06-09-5
  • When the list item is created, there is a Power Automate workflow that creates a folder in a document library with the same name as the custom reference field
  • When I open the list item, I wish to display the contents of that folder in the powerapps form
  • Therefore each list item should display the file contents of the files in each folder that is named the same as the reference number in the list item.

Does this make sense?

Hi @sudosaurus :

Try this code:

Filter(
    'Contract Documents',/*your library*/
    'Folder path' = LookUp(
        'Contract Documents',
        Name = ThisItem.'custom reference field name'
    ).'Full Path' & "/"  /*Get the specified path*/
)

Best Regards,

Bof

Hi @v-bofeng-msft 

 

I've tried both of the following as wasn't sure whether PowerApps would accept a folder name a percentage symbol?

 

Nothing is displaying.

 

'Contract Ref' is the name of the column in the list form where the folder name matches.

 

I assume I add a new blank vertical column into the PowerApp, connect it to my Document Library data source and then change the code for 'Items'?

 

Filter(
'Contract Documents',/Contract%20Documents/
'Folder path' = LookUp(
'Contract Documents',
Name = ThisItem.'Contract Ref'
).'Full Path' & "/" /*Get the specified path*/
)

 

Filter(
'Contract Documents',/Contract Documents/
'Folder path' = LookUp(
'Contract Documents',
Name = ThisItem.'Contract Ref'
).'Full Path' & "/" /*Get the specified path*/
)

Hi Bof @v-bofeng-msft 

 

any more thoughts on this?

The parts that start and end like /* your library */ are just comments, you can delete them or leave them there. In any case, remove the "Contract%20Documents" line in your expression, try...

 

Filter(
    'Contract Documents',
    'Folder path' = LookUp(
        'Contract Documents',
        Name = TextInput_ContractRef.Text
    ).'Full Path' & "/"
)

 

(the Name= part needs to be a reference to the field in your screen that contains  the Contract Ref / name of the folder)

 

For example, as per the guide earlier in this thread, this works for a SharePoint library named "Documents" which has a sub folder named "Automation" - adding the below expression to the 'Items' property of a Gallery displays all the files in the folder "Automation"...

 

Filter(
    Documents,
    'Folder path' = LookUp(
        Documents,
        Name = "Automation"
    ).'Full Path' & "/"
)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,637)