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

 

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (2,474)