How to Iterate through the contents of the Get OutLook MailMessage to a String collection

I need to read the mail, then determine the content of the message, and type the contents of the message into the specified location in the word document.

How to Iterate through the contents of the Get OutLook MailMessage to a String collection.

Please help me

Hi Money,

Here are the steps to iterate through the Mail Messages and access the content of each.
1.) Use Get Outlook MailMessages to get an array of Mail Message items.
2.) Use a For Each to iterate through the collection ( be sure to change the data type to MailMessage)
3.) In the sequence of that For Each loop, access the body by typing ‘Mail.Body.ToString’. Be sure to test this by dragging a message box in the loop and printing this value.



thank you ver much

How to write irregular data into a word document?

What type of data are you trying to write? What error are you getting?


Unable to assign range(

error (Type mismatch)

I would recommend iterating through the rows of the data table and first trying to print the contents with a message box. Use ‘for each row’ and then inside the sequence use a message box that prints ‘row(0).ToString’. If you get data, then find the index/column name of the column you want in that row and then input that data into word.

1 Like

Thank you very much. I’ve solved it.

1 Like

Fine, but one serious issue is here. When I use Get IMAP Mail Messages activity in uipath, and finally downloads the attachments in the desired email. But it doesn’t download the emails with extension ‘.eml’. I also applied check on the file extension to download the file(s) with extension ‘.eml’, but yet no success. Can anybody help me??? Here is the pic of my process workflow: