0

As of now, I am able to perform below two steps:-

1. I am able to save the Office 365 email (whole email itself) to SharePoint (online) document library as a .eml file using Logic Apps and open up in office outlook. - I am using Create File action

2. Also, I am able to save the metadata (To, From, Subject, CC) of incoming email in a SharePoint List. - I am using Create Item action

Now, I want to save the O365 incoming email attachments to SharePoint (online) list along with other email metadata. So, when email metadata is getting added in list (as per point-2 above), I want to save incoming email attachments as list item attachment. NOTE - I don't want to save incoming email attachments as individual items in a Library.

Any thoughts?

0

There is no direct option to add attachments in the "Create Item" action of the logic application.

Try to use "Add attachment" action to add the attachment obtained from the email to the specified list item.

Reference:

https://docs.microsoft.com/en-us/connectors/sharepointonline/#add-attachment

1
  • Hi. Yes that's correct I can use "Add Attachment" action, however the list item is getting created dynamically using "Create Item" action, so my set of actions are : When an incoming email arrives -> Check if it has attachments -> Create Item in List. Now before Create Item action, I need to add "For Each" control to loop through all the attachments. Please guide which actions should I use in order to attach the incoming email attachments to the list item. – Vipul Jain Aug 19 '20 at 10:56
0

I believe you are looking for 'Add an Attachment' action this allows you to add attachment in created item. your steps should be

  1. E-mail arrives
  2. Check for attachments.
  3. Create list item.
  4. ForAll loop in which you use 'Add an Attachment' action. Use item ID from step 3 for Id parameter in this loop. Pass in the file name and file content of attachment.

enter image description here

0

Here's a little detail to add to Akshay's response. When the email arrives you create the new SharePoint item to store the metadata and then you add the attachments to it. An example Logic App would look like the one shown below.

I've found issues when trying to get the attachment bodies in the trigger in Power Automate. I'm not sure if the same holds true in Logic Apps, but I'm going to get the attachments one-by-one just to be safe.

Please note that Outlook treats inline images as attachments so those will be saved as attachments to the SharePoint list item.

Logic app

Here are the trigger settings.

Trigger settings

Here are the settings for the action to get an individual attachment.

Get attachment

And here are the settings for the action to save the email attachment as an attachment to the SharePoint list item.

Add atachment

I hope this helps.

2
  • Thanks Rob, this really helps! I have another question regarding saving the body of the email in a SharePoint List column. When I am saving the email body using "Create Item" action, it's saving as HTML template in the list column (column type is Multiple lines of text). By any chance, is it possible to parse the HTML and save the actual body of the email in the column ? – Vipul Jain Aug 20 '20 at 13:21
  • You should post that as a new question rather than a comment. You can post the link to the new question here if you like. – Rob Windsor Aug 21 '20 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.