Showing results for 
Search instead for 
Did you mean: 
New Member

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. 

Helper II
Helper II

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'.




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


Hope this helps.





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!

Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager

Helpful resources

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (47,622)