Can't return outlook mail from workflow

email
outlook
workflow

#1

Scenario: I have a script dedicated to extracting an outlook mail based on the subject :

In arguments :

  • folder where to search mails
  • string to search for in subject
    Out argument :
  • First email to match, in a MailMessage object (System.Net.Mail.MailMessage)

Steps to reproduce:

Implement such a workflow, and call this workflow from any other one.

Current Behavior:

The robot will stay on hold, waiting to infinity, and I don’t know why (uipath logs show no errors). A message Box activity proved me that the invoked workflow reaches its end, with no more activities to perform, but the calling workflow doesn’t continue, it just wait, with no error nor end.

When ended manually, it returns the error depicted in attached picture

Expected Behavior:

The execution should obviously continue, and preferably with the passed MailMessage available for treatment.

Studio/Robot/Orchestrator Version:

Studio 2016.2.6274, community edition.
Robot is presumably same version (I don’t know how to check the robot individually, sorry)
Last stable behavior:
Last stable version:
OS Version:
Others if Relevant: (workflow, logs, .net version, service pack, etc):

error_mail_return


#2

Can you try with InvokeWorkflowFile instead?
Looks like a serialization problem.


#3

Hi there,

sorry for not considering your answer, I went on holiday for a while and then forgot about the issue.

I managed to work around the problem by filtering the mails with this instruction :
(From m in Liste_Mails where (m.Subject.Contains(motif_recherche))).ToList

The scheme is now :

  • extract some mails through “Get Outlook mail messages” activity
  • if some mails were found, filter through assign activity and the previous command
  • keep the first message from resulting list

It works fine, but for some reasons I couldn’t return a mail object at the end of workflow (nor the attachments)
To work this around, I save all attachments in a directory inside the mail workflow. I then end the workflow with no return, and browse the directory from calling workflow.

I know it’s a bit obnoxious, but that’s the only thing that worked in my case.