How to Only move imap message with PDF attachments?


I have a problem that I can’t solve on my own, and I tired to look for a solution and was unable to find an answer. So, I really hope that you can help.

I need to download only PDF attachments from the mails, and then only move those mails to a “processed” folder. (properly by using “Move IMAP mail messages”)

Right now, the flow is as follows:

Get IMAP Mail Messages → For Each → IF (condition: item.Subject.ToLower.Contains(“”) → Save Attachments (Condition: “^.+.(([pP][dD][fF])$” ) →

But then what do I do? I have used a “Move IMAP Mail Message” activity, but if I am using the “Message” variable from the “Get IMAP Mail Messages” activity, then I will be moving every mail listed in that variable and not only those with the PDF attachment.

Hope there is a someone with a brilliant mind to solve this….

@Thomas_Eld Using Save Attachments Activity with that Condition will only Save Pdf Attachments right ? If that’s working fine, then there’s a way to solve it :sweat_smile:

@supermanPunch hm no that format did’nt work. but I am able to filter it just by useing “.pdf” :confused:

@Thomas_Eld Ok So you were able to Filter the PDF files using that Filter, Then you can use the Output of Save Attachments Activity, To get the Count of Attachments , If the Count is More than 0, Save that Mail Message to a List
In this way you have a List of Mail Messages that has a PDF in it, The i guess you can use Move IMAP mail Message Activity inside a For Each of MailMessageList

I hope you understood my Suggestion :sweat_smile:

@supermanPunch , Well. i think i understand where you wonna go at, but i dont konw how to get there :slight_smile:

I mannaged to get the output from the “Save Attachments” activity into a variable of type
= “System.Collections.Generic.IEnumerable(Of String)”. But, what then?

1 Like

@Thomas_Eld Is it possible for you to share the xaml file?

@supermanPunch yes. Main.xaml (24.9 KB)

@Thomas_Eld Check this , I altered a Bit :
Main.xaml (25.9 KB)

1 Like

@supermanPunch TY So mutch !! you are a true god among us mortals :wink:

It is working now. :slight_smile:

@Thomas_Eld Please Refrain from telling such things :sweat_smile:, People are people :smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.