Get outlook mail message not working with attachment in folder

I am new to ui path. I have created a simple workflow to read my outlook email messages. The get outlook mail messages is working when I do not have any attachment in my mail folder. But if there a mail with attachment , it is not executing. It is in execution mode only. after half an hour i aborted the execution.
The log shows following:
10:25:29.0816 => [INFO] [UiPath.Ipc.NamedPipe.NamedPipeServiceEndpoint] [53] [thread 53] received request OnLog from a9a0f4d1-ca9c-4e68-b0ff-7404f29a99b0…
10:25:29.0595 => [INFO] [UiPath.Studio.Shared.Logging.OutputLogger] [8] Emailautomation execution started
10:25:29.0816 => [INFO] [UiPath.Ipc.NamedPipe.NamedPipeServiceEndpoint] [8] [thread 8] sending response for OnLog from a9a0f4d1-ca9c-4e68-b0ff-7404f29a99b0…
11:01:03.5005 => [ERROR] [UiPath.Studio.exe] [1] System.InvalidOperationException: Cannot perform this operation while dispatcher processing is suspended.
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority)
at UiPath.Studio.Shared.Utilities.CrossAppDomainUtils.CheckExistingWindowChrome(Object sender)

Please help me to resolve the same.

Hello @MB2005 and welcome to the community!

Mind sharing screenshots of your workflow?

here is my screenshot.

@MB2005 - First off, on your things like item.To and item.Body, you do not need “.ToString” as those properties are already of type “String”. It doesn’t hurt, but it isn’t needed either and tends to clutter the code making it less readable.

Question: What are the attachment sizes? And are you sure its the attachments that are causing the hang? (trying different tests - could be that it just happened to hang when attachments were in email)

Thanks. I will remove ToString.
But, I have tested the folder without attachment, it worked and sent mail. But when I added one email with a 15 kb attachment it did not. I tried multiple times.

Thanks for the reply. 15kb is pretty small. When the email with attachment was in there, were there more emails? About how many emails are you working with?

So far, I cannot replicate the issue. I see you call a message box, when you run the code, are you getting the message box, and then it hangs, or does it seem like nothings happens ever when there is an attachment, and that running when there are non produces message boxes.

A message box could make it seem like it hung if it isn’t clicked (I like to use writeline activity b/c it does the same thing w/o needing human input - just runs like normal program flow)

Also, your log is referring to Chrome - are there other activities you are running that you did not include here that potentially could be impacted?

Hi, I am running in chrome. The folder is having only 4 mails. and also when it hangs there is nothing comes. Output shows execution started. I have put breakpoints. It does not come out to next if block.

Sorry, for this one I have not done anything in chrome. I also watched its telling chrome. not sure why.

@MB2005 - So, if no attachments, does it run, and you send emails (for the ones that contain the string in “To”) AND see the message box (for the ones that don’t contain the string in “To”)

Also, are you running this in Studio or starting a job in Orchestrator?

I am running in studio. Yes when no attachment bot if and else works

if i debug i get this in output.

Oh. It never makes it to the For Each. Can you share the details of your Get Outlook Mail Messages Activity? Redacted if you need to - but its hanging on the message processing.

Hi Please find the snippet from main.xaml attached and please help me how can i proceed?
<ui:GetOutlookMailMessages Account=“{x:Null}” Filter=“{x:Null}” TimeoutMS=“{x:Null}” DisplayName=“Get Outlook Mail Messages” GetAttachements=“False” sap:VirtualizedContainerService.HintSize=“771,22” sap2010:WorkflowViewState.IdRef=“GetOutlookMailMessages_1” MailFolder=“Test” MarkAsRead=“False” Messages=“[Mymessagelist]” OnlyUnreadMessages=“False” Top=“30” />
<ui:ForEach x:TypeArguments=“snm:MailMessage” CurrentIndex=“{x:Null}” DisplayName=“For Each” sap:VirtualizedContainerService.HintSize=“771,519” sap2010:WorkflowViewState.IdRef=“ForEach`1_2” Values=“[Mymessagelist]”>

Can you screenshot the properties of your Get Outlook Mail activity?
Mask anything that is confidential

here it is

I tried one more option, when I try the same code with my hotmail account in outlook it works, but it does not work with my office email id? is there any restriction if the email is corporate email id for attachment? where to check? as I am not getting any error not able to proceed.

You’d have to check with your email administrator.

Hi, Now I am able to work with mt emails. The only challenge I need to filter based on subject contains alert and today’s email. But when I use the following for subject contains filter it works. My code is “@SQL=” + “”“” + “urn:schemas:httpmail:subject” + “”“” + " like ‘%alert%’
But I am not able to add the and clause for today’s date.

Please help me,Thanks in advance

Use AND operator to filter the date

“@SQL=(”“urn:schemas:httpmail:subject”" LIKE ‘%“+argSubject+”%’ AND ““urn:schemas:httpmail:datereceived”” = “+DateVar+”)"