cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jhud2018
Level: Powered On

Upload email attachment to Sharepoint folder

I am trying to have an incoming email with an attachment automatically send that attachment to a sharepoint folder. 

 

Problem #1. I'd like it to go to the Sharepoint site's own email, but i'm not sure how to configure that. For now I have it going to my personal email, which will work alright. 

 

Problem #2. I can get the file to be uploaded to the folder, however often it won't open in Office 365. 

 

Problem #3. I anticipate many of the attachments that I want to upload will have the same name, which is why i'd like to get Flow to re-name the file based on the date. However, when I try this, it will add the date to the end of the file format causing issues opening. For example, testdoc.xlsx will be re-named to testdoc.xlsx1082018

 

The attachments will be excel files. In the event I can't get this working, what is the best way to create a list from an attachment when a new email is recieved? 

 

I can post screenshots if necessary, please let me know. 

2 REPLIES 2
scotth82
Level: Powered On

Re: Upload email attachment to Sharepoint folder

Hi Jhud2018,

 

I imagine Problem #2 and #3 are related and can help you fix both.  Unfortunately not sure how the connectors work with SharePoint email addresses.

 

1) So I'm guessing you are using the trigger 'When a new email arrives' and in the advanced options you mark the 'Has attachment' flag to 'Yes' and maybe add other filters such as specific subjects.

 

2) Use the action 'Get email' and for the Message ID field use the 'Message ID' dynamic content field.  Also ensure you click the flag to 'Yes' for Include Attachments.

 

3) Now we need to use the action 'Create file'.  Select the SharePoint URL and document library location.  In the File Name box we need to add an expression after the file name so we can add the date but we also have to change the file type at the end of it too.  So for example on my flow I have that field set to 'Weekly Report - [EXPRESSION].pdf where the expression is - formatDateTime(body('Get_email')?['DateTimeReceived'],'yyyy-MM-dd').

 

This results in the file name "Weekly Report - yyyy-MM-dd.pdf.  You will obviously have .xlsx instead of PDF.

 

Also then add in the 'File Content' field some dynamic content for 'Attachments Content'.

 

1.png

 

This should then allow you to open the file in Excel online.

 

Hope this helps.

 

Scott

 

Highlighted
Administrator
Administrator

Re: Upload email attachment to Sharepoint folder

Hello, @jhud2018!

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @scotth82‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,298)