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

how to offer a pdf to download for every app user over onedrive

Hello together,

 

i have only a small question. I created an app which creates a pdf. Over a button in the app, everyone can download this pdf. Now how can i set settings, that everyone can download this pdf over the button to his computer? At the moment the pdf is saved in a folder in my OneDrive.

Does the app needs his own OneDrive-account in which he can save the pdf and to offer the pdf to download for everyone? Will everyone need full access to the flow and the folder in the OneDrive?

 

I really have no idea how I can do it, so that every person who uses the app can actually download the PDF...

 

Hope someone has an idea to help me.

 

Thank you very much.

 

 

Best regards,

CD

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @CanD ,

I tested this on the my OneDrive Root folder and it opened - your URL needs to be "dynamic" and the user name part is however in a different format to what you can get from User().FullName - your Launch code should be something like this

With(
   {
      wUserName,
      Substitute( 
         User().FullName,
         " ",
         "_"
      )
   },
   Launch(
      "https://com-my.sharepoint.com/personal/" & 
      wUserName & 
      "_po_de/_layouts/15/download.aspx?SourceUrl=/personal/" & 
      wUserName & 
      "_po_de/Documents/APP-Data/Results/"&flowAnswer.erbnisblatt_user"
   )
)

 

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

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @CanD ,

You did not say how the PDF was created - if from a Flow initiated from Power Apps, it will however be in the user's OneDrive. The only way to get it in your OneDrive (and share a folder for everyone) would be to initiate the Flow on another trigger (When an Item is created for instance), then the folder could be shared. You need to understand Power Automate to do this.

 

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.

Hi @WarrenBelz 

thank you so mutch for the answer.

I create the pdf with a flow. I did it in nearly the same way like Shane Young did in his video "PowerApps PDF Generator using MS Flow...". In my oneDrive i created a folder were the pdf got saved. In the flow i added the exact path to that folder. To download this pdf i created a button were it can be downloaded over the link to this path to my onedrive folder

Launch("https://com-my.sharepoint.com/personal/myName_mySurname_po_de/_layouts/15/download.aspx?SourceUrl=/personal/myName_mySurname_po_de/Documents/APP-Data/Results/"&flowAnswer.erbnisblatt_user)

 

If i start the app and create the pdf everything works. I can also download this pdf. If a different user do this, he can't create and can't download it. The different user has permission to use the app and the flow. I also gave some more rights for the onedrive folder, but he is still getting the error message that the file coud not be found. Please look Screenshot1, there you can see that the user almost have all rights.

 

Unfortunately I am completely stuck and have not been able to avoid this problem for weeks ...

 

CanD
Helper IV
Helper IV

Hi @WarrenBelz 

 

sorry its me again.

I made a couple of changes. It is no longer necessary to save every PDF. It is enough for me if the user can download his own generated pdf directly. I have a picture of my current flow. I did it this way because I thought it would be easy if the PDF was saved beforehand. It is better if the PDF is not saved at all but is offered directly to the user for download. Do you know what I have to change for this now?

@CanD ,

The problem is that you are the only user with that folder structure in your OneDrive, so the Flow cannot create the PDF (and obviously cannot retrieve it). As I mentioned, when a Flow is triggered from Power Apps with a OneDrive connection, it uses the User's OneDrive, not the Flow creator's.

So either create it in the root directory (as I do) or create whatever folder structure you need in every user's OneDrive.

 

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.

Hi @WarrenBelz , sorry for the late answer. I did unfortunately not have access to my account. Thank you, that was an incredibly good help. Now I understand the problem. I will improve my MS Flow skills.
But I still have an important question and I really hope that you can answer that for me too. As you can see from this code, I started the download using the following function:

 

Launch("https://com-my.sharepoint.com/personal/myName_mySurname_po_de/_layouts/15/download.aspx?SourceUrl=/personal/myName_mySurname_po_de/Documents/APP-Data/Results/"&flowAnswer.erbnisblatt_user)

 

 

In the launch-function code i have always put "myName" on it, so it is the link to my oneDrive. I have changed my flow to save it in the root folder. So should i have to put in the Launch-Code the users name for example:

Launch("https://com-my.sharepoint.com/personal/userNAME_USERSurname_po_de/_layouts/15/download.aspx?SourceUrl=/personal/userNAME_USERSurname_po_de/Documents/APP-Data/Results/"&flowAnswer.erbnisblatt_user)

or does PA automatically search in the users onedrive?

If the flow is automatically executed on the respective user Onedrive, should the link to the download be adjusted? That means it shouldn't look in my OneDrive, but in that of the user. Am I right? What and how exactly do I have to adjust it then?

 

I thank you so much for your help....

 

 

Hi @CanD ,

I tested this on the my OneDrive Root folder and it opened - your URL needs to be "dynamic" and the user name part is however in a different format to what you can get from User().FullName - your Launch code should be something like this

With(
   {
      wUserName,
      Substitute( 
         User().FullName,
         " ",
         "_"
      )
   },
   Launch(
      "https://com-my.sharepoint.com/personal/" & 
      wUserName & 
      "_po_de/_layouts/15/download.aspx?SourceUrl=/personal/" & 
      wUserName & 
      "_po_de/Documents/APP-Data/Results/"&flowAnswer.erbnisblatt_user"
   )
)

 

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

Hi @WarrenBelz 

again, thank you so so so much for helping me. I did it like you said and now my biggest problem is solved. I'm searching for solutions for that over then 3 weeks. Finally you solved it... Thank you again.

 

Best regards,

CanD

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

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.

Top Solution Authors
Top Kudoed Authors
Users online (3,236)