Is it possible to pass boolean values into activities?

I would like to pass Boolean values into for example the exchange get mail messages activity. I’m aware that the checkbox’s aren’t listed as arguments. Would it be possible to do something like InvokeMethod and recreate the activity so I can pass the boolean value as a parameter? If not it looks like I’d be forced to create a potentially nightmarish flowchart to do the same thing.

Hi @Tracy_Schultz and Welcome to the Forum!

Theoretically you can yes, using either invoke code, invoke method with the WorkflowInvoker class.
This, however is very tedious and quite edgy from a reverse engineering perspective

Here is an example using Invoke code with the simplest possible example (Message box activity) setting the Topmost. You can try to change to TopMost boolean and see that it is applied.

Note that I surrounded my Invoke code with a TryCatch to get the proper exception message.

InvokeActivity.xaml (9.7 KB)

As you can see on this example, you will need to fill all Arguments according to their types with InArgument(Of T) objects so the activity will work. Then you can Invoke it via the Workflow invoker.

For your case, your code inside the Invoke would look like bellow, but it will be tricky to fill as it requires many arguments.

 Dim activity As UiPath.Mail.Exchange.Activities.GetExchangeMailMessages = New UiPath.Mail.Exchange.Activities.GetExchangeMailMessages()
activity.Server = New InArgument(Of String)("123")
activity.Password = New InArgument(Of String)("123")
activity.IsBodyHtml = False

Well, it would be simpler if this idea would come true so GoGo upvote :slight_smile:


1 Like

@Florent_Salendres Thank you for the info and the welcome! I do see it’ll be tricky but in this case I’m doing this to build tools to be turned into our own internal company repo to allow us to quickly build flows going forward. So in our case it’s worth it.

I’ve gotten to where I’m passing my variables in, however I’m running into difficulties with the output.

Here’s my code so far.


Dim activity As UiPath.Mail.Exchange.Activities.GetExchangeMailMessages = New UiPath.Mail.Exchange.Activities.GetExchangeMailMessages()
activity.Password = inPassword
activity.Domain = inDomain
activity.User = inUser
activity.GetAttachements = inGetAttachments
activity.Top = inTop
outMessages = activity.Messages

And here are my arguments


This is the error I’m getting.



The workflow has validation errors. Review and resolve them first.

No compiled code to run
error BC30311: Value of type ‘System.Activities.OutArgument(Of System.Collections.Generic.List(Of System.Net.Mail.MailMessage))’ cannot be converted to ‘System.Collections.Generic.List(Of System.Net.Mail.MailMessage)’. At line 12

I’m sure the answer is something obvious but right now I’m having trouble seeing it. If someone could provide me a pointer to figuring out where I’m going wrong it would be greatly appreciated.

1 Like