GetExchangeMailMessage Need workflow that only forward emails that have >=1 pdf attachment, and move this email to folder A

I need a workflow that checks all new emails, loop through all the attachments of each email, if one or more attachments contain pdf, move this email to a folder, and forward this email to person A.

Workflow should not forward any emails( or move to folder) that does not contain any pdf formatted attachments.

How can I achieve that? Please help

1 Like

Iā€™d like to preface by suggesting that you set up the inbox rules to make these moves automatically. You will not need UiPath and can streamline your process if you can set rules to automatically move items in the folder without a bot. However, if you need to use a bot, see the suggestion below.

Use the Get IMAP Mail Messages activity to get a list of all of the messages in the inbox. Now, use a For Each loop over the output list of messages, and another For Each loop within that to iterate over the attachments (Msg.Attachments, assuming Msg is the current message item). Within the For Each loops, use an If activity with the following boolean (assuming AttItem is the current list of attachments): AttItem.Name.Contains(".pdf"). For the If condition, use Move IMAP Mail Message to move it to the desired folder.

1 Like