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

How to download file in PowerApps sent from Power Automate

I have a canvas app with a screen that shows a list of files associated with the data currently being viewed. Those files are stored in a SharePoint library that the app user does not have access to. In order to view the file list, upload additional files, or delete files, the app sends a request to a Power Automate flow, which then uses an HTTP action to call another flow. This second flow then performs the requested CRUD operations.

 

I have the "create," "update," and "delete" parts of CRUD working fine, but not the "read" part. On the screen, there is a gallery in which each item is a file in the list. In each item is a button that should allow the user to download the respective file. I can build a pair of flows that will read and send the requested file data to PowerApps, but I can't find a way to then have PowerApps save the file to the user's default download folder (or any folder). Once my flow sends the file data to PowerApps, how do I instruct PowerApps to save that file to the user's computer?

 

I have looked into the Download() function, but I don't think this will work, because I need to have a URL that is accessible to the user. Due to security reasons, the SharePoint library containing the files cannot be made directly accessible to the users, which is why I'm using a set of flows to accomplish this. I want PowerApps to save the file that it receives from Power Automate directly.

5 REPLIES 5
JoaoN
Helper IV
Helper IV

Did you try to use the Launch function?
I do not know if is that your purpose, but Daniel Christian talks about downloading CSV file from a Filtered Gallery on this video. Maybe it can be useful to you:

https://www.youtube.com/watch?v=QTbVMu6DIfQ&list=PLK4GUAjzwV6FyI0Jh9gHuYBrz4P3e9R6Z&index=38&t=1719s

Hi, @JoaoN.

 

Sorry for the delay; I was pulled away from this for several days.

 

Unfortunately, while that video is very helpful for downloading a file from OneDrive, it doesn't address how to download a file from SharePoint. The problem is, his method requires the file to be made available to everyone via a link. However, the file in my SharePoint library needs to remain secured, and accessible only via PowerApps/Power Automate. Ideally, the event would follow something like this...

  1. User clicks a button in PowerApps.
  2. PowerApps calls a Power Automate flow.
  3. Flow gets the file content and metadata from SharePoint.
  4. Flow returns the file data to PowerApps.
  5. PowerApps saves the received file data to the local disk.

The only real step that I cannot figure out here is step #5. I can build a flow that does return the file metadata and binary content to PowerApps, but I can't figure out how to have PowerApps save that incoming data to disk.

anibra
Resolver II
Resolver II

Hi @AIUYM19, have you found a solution to your problem yet? I have such a scenario and I could not find a way to do it

zmorek
Super User
Super User

You could consider something like:

 

  1. User clicks a button in PowerApps.
  2. PowerApps calls a Power Automate flow.
  3. Flow gets the file content and metadata from SharePoint.
  4. Flow creates copy of file in library that user has permissions to access
  5. Flow returns the file data to PowerApps.
  6. Flow passes URL of file to PowerApps
  7. PowerApps Launch() URL
  8. PowerApps saves the received file data to the local disk.

 

With this you'd probably need to consider some Flow to automatically purge the "temporary" files it creates.

anibra
Resolver II
Resolver II

Thank you @zmorek . I found a way how to do that. This video was very helpful:
https://www.youtube.com/watch?v=QTbVMu6DIfQ&list=PLK4GUAjzwV6FyI0Jh9gHuYBrz4P3e9R6Z&index=40&t=1719s

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,906)