GetOutlookMailMessages sometimes takes minutes to complete

For whatever reason, the UiPath activity GetOutlookMailMessages sometimes takes seemingly forever to complete.
The GetOutlookMailMessages activity actually opens Outlook.exe in the background, you can spot the icon in systray, and closes it after execution. I want to wait for Outlook.exe to close, before starting the next step of the robot.
And so I have made a generic activity that waits for a specified process to close, in this case I use this wait activity right after GetOutlookMailMessages, to be sure Outlook.exe is not running.
Within the wait, there is a retry scope which currently retries 20 times, with an interval of 5 seconds.
Often times, outlook.exe is still open after 5x20 seconds. I have tried on different VDIs, on multiple versions of Orchestrator and robot.exe, even different versions of the UiPath package containing the activity, all to no avail. I’ve also disabled all 3rd party extensions in Outlook, but I can’t seem to find the culprit. And it seems like it is random.
Can anybody confirm this behaviour, or does anyone have a solution?
Best regards, Mikkel

But it takes a long time even when bringing no messages? Or could it be that you have a lot of messages with attachments or something like that? cause if you put a new activity after getoutlookmessages it should just start after outlook ends…

I can’t find the pattern, but yes there are attachments.
You are right that UiPath does not wait until Outlook closes before starting the next activity, which is the problem. This is the reason I had to make a wait-for-process-to-close workflow, that takes outlook.exe as a parameter and finishes when outlook closes by itself or gets killed by the workflow.