0
I’ve developed some custom activites for UiPath, some of them to send emails with some custom behaviours (Change the reply recipient of an email, take all the thread and re send it…)
Thing is, there weren’t any problem with it till we faced a security window on Outlook that you should push on “Allow” to continue sending or getting an email from it.
This pop up actually blocks any email outlook related activity (from UiPath too). We actually sorted it out with a Paralell activity for UiPath activities.
With custom activities things differs, as Interop’s Send method locks the CPU/Thread/Whatever, not allowing the Paralell activity to do its job.
UiPath custom activities should be inherited or derived from CodeActivity, which is synchronous, so I used AsyncCodeActivity that implements
protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
protected override void EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
On BeginExecute I have my Send method, that still blocks the process. And yeah I’ve hacked to return something that has nothing to do with the process itself.
return func.BeginInvoke(2, 1, callback, state);```
As you can see, I'm not really used with asynchronous or thread-related coding.
So, can anyone help me how to send an email (from Outlook, not SMTP or anything related to) in an asynchronous way? Seems like UiPath activities are doing it and I want to replicate.
Thanks you very much.
Kind regards,