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

Outlook to SharePoint Email Body and Attachments

We are looking to utilize Outlook, Flow, and SharePoint for an applicant tracking purpose. We receive applications via email and would like to pull the email from Outlook (Outlook 365) and put the "From","Subject","Attachment(Resume)", and "Body" of email into a file. It seems to be coming in as a corrupt file. The file does not need to be editable. Is there any way to complete this? And if not, is there a possibility to have Flow create a new folder in Sharepoint for each incoming email (Applicant) and then place the two files (One being the body of the email, and the other being the attachment (resume) in the new folder? Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @bschapley,

 

Which file type is the attachment of the incoming email?

Do you want to create a file within your SharePoint library based on the "From", "Subject", "Attachment" and "Body" of the email?

 

Based on the screenshot you provided, I think there is something wrong with your flow's configuration. The File Content field of the "Create file" action of SharePoint connector is required to fill a binary data, but the From dynamic content and the Subject dynamic content return text data, the Body dynamic content returns Html data (The Content dynamic content returns binary data).

 

More details about the "Create file" action of SharePoint connector, please check the following article:

Create file

 

I afraid that there is no way to put the "From", "subject", "Attachment" and "Body" of an incoming email into a file in Microsoft Flow currently. 

 

In addition, you could consider take a try to create a new folder in SharePoint for each incoming email (I assume that the name of the new created folder is based on the Received time of the incoming email) and then place the two files that you mentioned into it. I have made a test on my side and please take a try with the workaround:

  • Add a "When a new email arrives" trigger, Has Attachment and Include Attachments are both set to Yes.
  • Add a "Html to text" action, Content field set to Body dynamic content of the trigger.
  • Add a "Apply to each" action, input parameter set to Attachments dynamic content of the trigger.
  • Within "Apply to each" action, add a "Create file" action, specify Site Address, Folder Path field set to following formula:
/Reporting1/formatDateTime(...)

 

The formatDateTime(...) expression read as below:

formatDateTime(triggerBody()?['DateTimeReceived'],'yyyy-MM-dd')

1.JPG

 

Note: The Reporting1 within above formula is a library in my SharePoint site.

 

File Name field set to Name dynamic content of the trigger, File Content field set to Content dynamic content of the trigger.

 

Add a "Create file 2" action, specify Site Address, Folder Path set to following formula:

/Reporting1/formatDateTime(...)

The formatDateTime(...) expression read as below:

formatDateTime(triggerBody()?['DateTimeReceived'],'yyyy-MM-dd')

File Name field set to ApplicantBody.doc, File Content field set to the output of the "Html to text" action.

 

Image reference:3.JPG

 

The flow works successfullly as below:4.JPG

 

 

 

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User III
Super User III

Can you post a screen shot of your Flow? That will make it much easier to assist.
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
New Member

Screenshot of what I was attempting. The file comes in as "Corrupt". Is flow able to put From, Subject, Body of Email, and Attachement in one Read Only File?Flow Screenshot.PNG

Thanks. Just posted the screenshot.

Community Support
Community Support

Hi @bschapley,

 

Which file type is the attachment of the incoming email?

Do you want to create a file within your SharePoint library based on the "From", "Subject", "Attachment" and "Body" of the email?

 

Based on the screenshot you provided, I think there is something wrong with your flow's configuration. The File Content field of the "Create file" action of SharePoint connector is required to fill a binary data, but the From dynamic content and the Subject dynamic content return text data, the Body dynamic content returns Html data (The Content dynamic content returns binary data).

 

More details about the "Create file" action of SharePoint connector, please check the following article:

Create file

 

I afraid that there is no way to put the "From", "subject", "Attachment" and "Body" of an incoming email into a file in Microsoft Flow currently. 

 

In addition, you could consider take a try to create a new folder in SharePoint for each incoming email (I assume that the name of the new created folder is based on the Received time of the incoming email) and then place the two files that you mentioned into it. I have made a test on my side and please take a try with the workaround:

  • Add a "When a new email arrives" trigger, Has Attachment and Include Attachments are both set to Yes.
  • Add a "Html to text" action, Content field set to Body dynamic content of the trigger.
  • Add a "Apply to each" action, input parameter set to Attachments dynamic content of the trigger.
  • Within "Apply to each" action, add a "Create file" action, specify Site Address, Folder Path field set to following formula:
/Reporting1/formatDateTime(...)

 

The formatDateTime(...) expression read as below:

formatDateTime(triggerBody()?['DateTimeReceived'],'yyyy-MM-dd')

1.JPG

 

Note: The Reporting1 within above formula is a library in my SharePoint site.

 

File Name field set to Name dynamic content of the trigger, File Content field set to Content dynamic content of the trigger.

 

Add a "Create file 2" action, specify Site Address, Folder Path set to following formula:

/Reporting1/formatDateTime(...)

The formatDateTime(...) expression read as below:

formatDateTime(triggerBody()?['DateTimeReceived'],'yyyy-MM-dd')

File Name field set to ApplicantBody.doc, File Content field set to the output of the "Html to text" action.

 

Image reference:3.JPG

 

The flow works successfullly as below:4.JPG

 

 

 

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (10,438)