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

Access SharePoint Document Library Folder Contents in PowerApps

Good day,

I hope everyone is well and safe with your families and loved ones!

 

Need some advice please, been going at this thing for 24 hours now without any success

Basically, I'm building a Digital Archive on a SharePoint Library and using PowerApps as an interface (To support staff working from home); in details I have a SharePoint Document Library (7,000 Folders and about 18,000 files) in a Gallery in PowerApps, showing only folder names without contents.

 

What I want to achieve is the following:

When I click on a folder, I would like to see it's contents (Can't use 'Folder Path' or anything else due to Delegation issues).

I thought the best way is to fetch the folder contents from SharePoint using Flow, and saving them to a gallery - but I don't have any experience with JSON and have no idea how to do this correctly.

I don't know whether to use "GET FILES" or "LIST FOLDER" or "SEND AN HTTP REQUEST" - honestly they all confuse me lol

 

Below is the full Process I would like to Implement - for reference:

- Create a new folder in a SharePoint Library from Powerapps (DONE)

- Add Folder/File properties from Powerapps (DONE)

- Attach new files to SharePoint Library from PowerApps (IN PROGRESS)

- See all the Document Library Folders (DONE)

- Access the folder contents once a user select a folder (All the files listed within the selected folder) (STUCK HERE)

- Display all the columns that describe the file in the SharePoint Document Library (I suppose it's called File Properties or Metadata) (STUCK HERE)

- Be able to update the File Columns/Properties when needed (Such as change the status) (I THINK I KNOW HOW TO DO THIS)

 

I've read over 50 articles and support tickets but still struggling with this thing

Thanks in advance - any help will be truly appreciated

20 REPLIES 20

Hi @Pstork1 ,

Thanks for responding back

I tried creating a new flow with a manual trigger, only adding the "Get Files {Properties only)" for testing purposes and got the same results, it returns blank. Is there a special syntax for the "Limit Entries to Folder" part? I just inserted the folder path manually for testing purposes - Path as follows: /CL DIGITAL ARCHIVE/NADER TEST SPACE

 

On a separate note, the "Select" part which collects the information about the files inside the folder, will it collect information for all the files that will be later returned back to PowerApps, or do i need to to a loop or Apply to Each in order to build the array/Table?

 

Thanks once again, your support is really, truly and sincerely appreciated 😃

@Pstork1 ,

So i tried it on another folder and it worked, Could it be because the target folder is above the 5,000 threshold?

ID of the successful test is 3; however the one that failed to fetch anything was 7,274

Not sure if this makes a difference, just trying to understand what's going on

Pstork1
Dual Super User III
Dual Super User III

That would do it.  Using Power Automate doesn't change the delegation rules, it just gives you more control (the ability to limit the retrieval to a specific folder or use a view).  But if the folder has more than 2,000 files then that is going to be an issue and I don't think is a way to get around that.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Pstork1
Dual Super User III
Dual Super User III

The select will create an array containing the fields you specify for all the records in the value array you feed in as input.  No need for a loop.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @Pstork1 

In that case, perhaps the below method would work?

  • List Folder
  • (Apply to each) - Loop through each file and get it's properties "GET FILE PROPERTIES
  • Save the retrieved information/properties to an array or table
  • Post this information back to PowerApps

Just not sure about the following:

- How Pass the File ID to the "GET FILE PROPERTIES

- How to save the results with the APPLY TO EACH since it is looping. Does the "Select" work in this case or will I have to build an array or table within flow?

 

get file properties.png

Thanks so much for your valuable time

Pstork1
Dual Super User III
Dual Super User III

The point is that Get File (Properties Only) should return the same results that List Folder does, just with more properties included.  Unless you turn on get nested items in which case it walks all the subfolders as well.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Honestly I haven't, It's just strange. The GET FILES Properties Only works with folders that are at the beginning of my library (ID numbers 20, 50, etc) however when we get to folders added recently (ID number 7250), it returns blank

Note that Every folder will not have more than 100 files inside of it

Strange behavior really since the List Folder works as expected 😞 

Hi @Pstork1 

Just tried something and it worked; however need to fail proof it for future use

I've created a number column "IDCOUNTER" for every file that was added that mimics the file SharePoint ID number, for indexing purposes.

For the "GET FILES (PROPERTIES ONLY)" - I added a filter with the following IDCOUNTER ge 7274

This works now since i know my IDCOUNTER numbers; however i thought to fail proof this and allow for dynamic search I could do the following:

1- LIST FOLDER

2- Loop through all the files in the folder

3- Capture the FILE ID (convert it to float) and save them to a variable

4- Enter these in a the "GET FILES (PROPERTIES ONLY)" filter

5- Success !! 

 

My problem with this as follows:

- How to loop through the files in step 2

- how to save the returned ID's in a way that I could later use in the filter

I am trying to go at this on my own; however any advice to help speed up would be appreciated 🙂  

Pstork1
Dual Super User III
Dual Super User III

If you are nesting folders double check that you've turned off the get nested items.  That might be causing a problem.  Not sure what else could be wrong.  If it works on older folders but not newer ones you might have to open a service ticket.  It sounds like something is wrong in the backend storage.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Hi again,
Thanks for not forgeting about me. I found another way to doing this actually after giving up on the flow.
Basically i added 2 columns in the library, firsr column is called "Folder" and will have either a "yes" or "no" added at the time when the folder or file is added from powerapps, and another column that contains the name of the folder for filtering, added only when a file is created using powerapps.

I then create 2 galleries in powerapps, one to show folders using the "startswith" for filtering and add the startswith(folder, "yes"), which shows me all the folders.
For the files gallery, i just add 2 startswith functions for the filter:
- startswith(folder, "no"), startswith(foldername, gallery.selected.foldername)

And boom, i have the files in that folder without any calls to flow or any limits (since startswith is completely delegable using text columns)

Hope this can help someone, and thank u so much for your advice, definitely learnt a few things these couple of days

Regards
Luka

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,701)