I would like to build a flow that monitors my Inbox and downloads a file linked in the body which is given as a URL. The "When email arrives (v3)" trigger is working. I'm getting hung up on how to build the appropriate function to look for a URL in the body of the email that contains the link to download a PDF file and save to my Documents folder.
The email has a link to a .txt file and another link for a .pdf file. I only need to download and save the .pdf file to my documents folder.
Hi @mohuddle ,
Nice! Yeah it was a great experience for me too. What I have used in the past, for unique file names is to use something like:
formatDateTime(utcNow(),'yyyy-MM-dd')-rand(1000,2000).pdf which will give you a file name like:
2023-12-26-1234.pdf (so date and random number)
Great exercise for me to go through all that. Much appreciated. I'm working on parsing the URL for a filename. Will post new thread for help on parsing the URL and turning into filename after I try some myself.
Hi @mohuddle,
Nice! I am glad we figured it out together and I learned a lot too! Now for the important part: please mark one or more of my replies as a solution to help others find this walkthrough too!
Success!!
Results:
Hi @mohuddle ,
Ok, I figured it out and did a test for you. The destination file path needs to contain the file name.pdf in the path and I was wrong about the format: it's not the URL, it is the folder path, shown below.
Here in this example, I downloaded (and then uploaded to OneDrive) successfully!!! I recommend you get the flow working first and then you can work on the dynamic file name part (just name it something to test, like test.pdf).
Copy/pasted it all to text editor, screenshot attached. FWIW, if i copy/paste my Destination File Path into a new browser tab, it opens right to the Project Notebooks folder.
Hi @mohuddle ,
Yes! Getting close! What is the last part of the destination file path? Need to make sure it is correct. I believe the download URL is correctly formatted.
Looks like the last few attempts to test (when I said it was spinning) it wasn't seeing a "new" email any longer, so I just sent a another and it ran (but failed). Looks like I'm now grabbing the PDF URL ( [6] ) yay! and it is getting pulled in, but it seems to be hanging up on my OneDrive (if I'm reading this right). The connection is there in Power Apps. Do I need to put destination path in " "? Is there a way to find the path it's expecting and copy/paste?
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional