Logic App - Import 1 Attachment from an email with multiple attachments

Jon Graber 1 Reputation point
2021-05-05T17:23:26.81+00:00

I am currently receiving an email with 2 attachments. I only want to import one of those attachments and then archive the email. The problem I am facing is I can import the attachment and archive the email but it tries to do that for both attachments. So after the email is archived it tries to read it again.

94102-azurelogicapp-email.png

How can I only execute this once so that only 1 attachment is read and then the entire email is archived? Below is my structure as of today. I did have a condition where i looked at the attachment's name that i wanted. But that still didn't work.

Any thoughts?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,221 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,546 Reputation points
    2021-05-06T03:21:55.503+00:00

    Hi @Anonymous

    Welcome to Microsoft Q&A! Thanks for posting the question.

    As per the screenshot of the workflow, I can see that you have trigger for "When a new email arrives in a shared mailbox" then you are checking all attachments and creating the blob with the current attachment. But I don't see any condition that checks the attachment name inside the for each loop as you have mentioned that you are checking the condition.

    You need to write the condition inside the "for each" action to check if the current attachment matches with your name of the attachment that you want to save. If true then only execute the "Create Blob" action.

    For the second issue, on your "When a new email arrives in a shared mailbox" make sure you are specifying the Folder name field for which you want logic app to get triggered. If you are removing this field then for every email in any of the folders the logic app will gets triggered.

    The screenshot is for another action but the shared mailbox also has the Parameter "Folder" that you can define.

    94233-image.png

    Hope the above helps you. Feel free to get back to me if you need any assitance.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.