Option Strict On disallows late binding

email
outlook
studio
beginner

#1

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


#2

what is the type of mailSubject variable?


#3

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


#4

@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.


#5

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


#6

Try it as a String:

https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.subject(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2


#7

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)


#8

@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:


#9

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…


#11

Thank you


#12

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


#13

@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.


#14

A big thanks,

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