How to convert the System.Net.Mail.MailMessage to System.Collection.IEnumerable?

can any one tel me…

Can you explain a bit? @keerthi_97

I hope this will help you,

After getting the messages from get activity, you need to change the item type to mail.message in the properties pane… Are you missing that?

1 Like

Im did that… bt it will show error

Can you attach the workflow or screenshot of your error? @keerthi_97

You don’t need to change the message variable as System.Net.Mail.Message … The output variable of Get Outlook Mail Messages activity should be List as in the screenshot below …

Change the data type of that variable as in the screenshot


1 Like

my output variable only MESSAGE

I see that UiPath is showing error in step “Get Outlook Mail Messages”.
Make sure that when you are assigning variable in Output section of Get Outlook Mail Message. You set the variable using <Ctrl + K>. It will set variable type automatically as List
See screenshot for reference.



Whatever it is, the output of the Get outlook messages variable should be of type <List … So,

Here is the example with the variable name : message

If you see, the variable message is of type List …

Coming to for each condition, by default, item should be of type “Object”, so you need to convert it to System.Net.Mail.MailMessage to get the body or subject…


ok thank you… i got it.

Hi, did you manage to clear error? If so, please mark message which solved error. This will help others while going through thread.


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