How to filter outlook attachment file name?

Hi @phoenix123

Usually in Get outlook mail activity we can check only a mail HAS attachment or not
we cannot filter based on the file in the attachment

So we need to get the mail message list and then only we can check with the attachment has a file of type we need or not
these are the steps to be followed to get this done

  1. Use get outlook mail activity and get all the mails you want with a variable of type mailmessage collections and name it as out_mailmessage
  2. Use a for each loop and pass the above variable as input and change the type argument as mailmessage
  3. inside the for each loop use a assign activity like this to get the name of the file attached (with file extension)
    out_attachmentName = CType(item.Attachments.FirstOrDefault, Attachment).Name
    this would give the name of file with extension that is attached to the mail list, where item is the variable obtained from the for each loop
  4. now use a if condition like
    out_attachmentName.ToString.Contains(“.xlsx”)
    if this condition gets passed it will go to the THEN part of if condition where you can save that attachment alone with save attachement activity where mention the mail input as item and mention the folder where you want to save
    thats all buddy you are done
    Kindly try this and let know buddy
    Cheers @phoenix123
3 Likes