Email rules_du.xlsx (11.8 KB)
Hi,
I have a task to save outlook email attachment according to my pre-set email rules in attached excel file.
The purpose is to
1.Read all unread emails in outlook.
2.Save attachment from row “Sender” unread emails which contains row “Key word” to path in row “Folder”.
Appreciate for a workflow for guidance, I’ve tried many times but not succeed.
Sender Key word Folder zhang@dhn.com Shipment Notification C:\Users\z00371vw\Desktop\WK0401\RDA\DOC\DHL liu@abb.com Cutoms issue C:\Users\z00371vw\Desktop\WK0401\RDA\DOC\Liu Xiao Qin Xiang@tdk.com Today’s arrangement C:\Users\z00371vw\Desktop\WK0401\RDA\DOC\TDK kui@seec.com Task to do C:\Users\z00371vw\Desktop\WK0401\RDA\DOC\Du Kui
Dear,
Thanks for your reply.
I think the key part of this project is below part.
DT_RulesTable.AsEnumerable.FirstOrDefault(function(row) mail.Sender.Address = row(0).ToString AndAlso mail.Subject.Contains(row(1).ToString))
I compiled a similar words as your method but it doesn’t work.
I’ve successfully processed with each condition, but can not run with this multiple 2 conditions.
mail.From.Address.Contains(row(“Sender”).ToString) andalso mail.Subject.Contains(row(“keyword”)).ToString
System back with a compile error:
Overload resolution failed because no accessible “contains” can be called with these arguments: Public Function Contains…
Extension method…from ‘Object to Char’"
Dear all,
Case fixed.
Share my final workflow summary.
Read range of emailrules excel(output to a datatable MailrulesDT)
Get out look message(output to a list mailmessage variable Message)
For each mail in Message
For each Row in MailrulesDT
If Condition mail.From.Address.Contains(row.Item(“Sender”).ToString) And mail.Subject.Contains(row.Item(“keyword”).ToString)
Then
Save attachments
Mail
row(“Folder”).ToString