Option Strict On disallows late binding

Hello Everyone, I’m a beginner in UI Path and I have been trying my hands on Email Automation. I wanted to Create a Bot which should get triggered when a mail with a specific subject line is received in Inbox.

I have created this workflow.

As per the workflow, the Bot should wait till it gets the mail with required subject line and once it does, it should show me the Subject of the obtained mail.
Due to some reason, I’m getting this error saying “Complier error(s) encountered processing expression “message.Subject”. Option Strict On disallows late binding.”

Any idea where I’m going wrong?
Thank you

14 Likes

what is the type of mailSubject variable?

I don’t think this is the (only) issue, but your variable mailSubject doesn’t seem to be in the variables list?

@David_Johnston Thank you for the quick reply. Its scope is in the body of the for each loop.
Please a have look at this screenshot.

1 Like

@theo500 It’s Generic. Please have a look the screenshot attached in my reply to David_Johnston.
Thank you.

Try it as a String:

try changing it to String.

then select the “For Each” activity, go to the right pane and change the “TypeArgument” dropdown to “System.Net.Mail.MailMessage” (using Browse for types)

10 Likes

@theo500 @David_Johnston chaging it to string and [quote=“theo500, post:7, topic:5067”]
“For Each” activity, go to the right pane and change the “TypeArgument” dropdown to “System.Net.Mail.MailMessage” (using Browse for types)
[/quote]

Solved my problem. @theo500 If possible can you please explain why it was required to change the argument type.

Thank you :slight_smile:

4 Likes

For Each activity does not now what kind of data the collection contains hence it will automatically “see” each item from the collection as a (generic) Object ; blocking the access to the MaiMessage properties.

changing the TypeArgument you explicitly tell UiPath to treat each item from the collection as a MailMessage hence giving you direct access to its properties and methods (subject, body etc.)

hope it is fair enough…

4 Likes

Thank you

HI all,

I’m an starter with UIpath. I try to make the course level One. In practice excersize 3 i have some troubles. When i build to robot, it gives my the error Compiler error encoutered processing expression “Row (“First”)” impicite conversions not allowed by the option strict on.

Does somebody know how to repair this error/

best regards

@l.tersluijsen It means you need to convert the variable to a different datatype in order to use it. UiPath is basically saying: You’re trying to use this variable as being one datatype, while at that moment it actually is another datatype. This commonly happens when you’re trying to write out an integer, in that case you’ll have to add the method .ToString to allow you to use it as a string.

A big thanks,

this solved my problem. my .ToSting wasn’t in the right place