cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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. 

2 REPLIES 2
Helper II
Helper II

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
Community Manager
Microsoft Power Automate | Power Virtual Agents
Are YOU a member of a Power Platform User Group?
Fill out This Form to claim your Community User Group Member Badge!

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,859)