Not gettting the email address and file attachment name



hi iam trying to get the email address and attached file name .
from the email . mail.xaml (11.4 KB)

1> how to get all the email address array and file attached file name array.


Your work flow is working fine, if you want an array for email address and attachments name.
In the foreach loop while you are reading emails add EmailAddress and Attachment name in separate Array variable



List Of Mail Messages you got from the Mail Address as OutputMails
Now let us take the List of Mail Address as List A

List A= (From p In outputMails
            Select p.Sender.Address.ToString).ToList

Next Let us take List Of Attachments names as ListB

List B = (From p In outputMails
             Select(( From q In p.Attachments
	         Select Convert.ToString(q.Name)).ToList)).ToList.SelectMany(Function(x) x).ToList

p refers to each mailitem of Mail Collection
q refers to the each attachment of each Mail’s Collections.

I have not tested the code, :grinning: please try it.



Here is a working example -

EmailWorkflow.xaml (12.1 KB)


If you only have one attachment per mail, use mail.Attachments(0).Name. If there are multiple attachments per mail, do the following:

mail.Attachments will give you all the attachments in the mail.
Use ‘for each’ to loop through these attachments. THEN, you’ll do attachment.Name

For mail, use this: email.From.Address OR email.Sender.Address.


Hi Akshay,

Did you tried my solution?. you can get all the Sender Address and Attachments names by using two assign activities. No need of using loops and then adding into collections.:slightly_smiling_face: