I am new to UI Path and have been tasked with building a robot that can identify certain emails in Outlook and move them to another folder (amongst other things). I have followed the tutorial but am getting the error and cannot find a solution to it.
Can anyone help me please, I think I might be missing something quite simple.
Can you try using
item instead of
strMessages.Item both in your If statement and Move Outlook Mail Message activity?
The For Each loop automatically takes 1 element from the collection, in this case it is called item:
You can then use this
item as a variable, so for IF you would do this:
And for Move Outlook Mail Message this:
Thanks for the prompt response. I tried that but don’t get the options for Subject, etc. It shows an error of “Option Strict On disallows late binding”. Using strMessages gave me the email related options.
Can you select the For Each loop and send a screenshot of the properties? The loop item should match with the type of what you are iterating
@loginerror is right, if you are iterating on list of messages for each loop’s TypeArgument should be System.Web.Mail.MailMessage
I’ve changed it to TypeArgument System.Web.Mail.MailMessage but now it’s telling me Type MailMessage is not defined.
Actually that worked and the error has gone from the condition
It doesn’t like item in move messages now 'value of type cannot be converted to system.web.mail.mailmessage
I’ve figured it out. My strMessages variable was using System.Net.Mail.MailMessage to store the emails and the For Each was using System.Web.Mail.MailMessage. I’ve changed the TypeArgument in the For Each and it is working as expected now