GetOutlookEmails throws exception intermittently

The GetOutlookMailMessages Activity intermittently throws the below exception and I couldn’t find any helpful resources on this issue. Can someone please help me understand how to fix this.

23.10.0+Branch.master.Sha.e038c5a32a4f890ba12a3c04ac465dc8811521e0

Source: RetrievingSortingoutEmailRequest

Message: The operation failed.

Exception Type: System.Runtime.InteropServices.COMException

System.Runtime.InteropServices.COMException: The operation failed. at Microsoft.Office.Interop.Outlook._MailItem.get_HTMLBody()
at UiPath.Mail.OutlookAPI.AddHtmlBodyAlternateViewIfNeeded(MailMessage mailMessage, MailItem mailItem)
at UiPath.Mail.OutlookAPI.CreateMailMessageFromOutlookDynamicItem(Object item, Boolean saveattachments, String folderpath)
at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at UiPath.Mail.OutlookAPI.GetMessages(MAPIFolder inboxFolder, Int32 count, MailFilterVariant filterVariant, EOrderByDate orderByDate, Boolean onlyUnread, Boolean markAsRead, Boolean getAttachments, CancellationToken cancellationToken)
at UiPath.Mail.OutlookAPI.GetMessages(String account, String folderMail, Int32 count, MailFilterVariant filter, EOrderByDate orderByDate, Boolean onlyUnread, Boolean markAsRead, Boolean getAttachments, CancellationToken cancellationToken)
at UiPath.Mail.Outlook.Activities.GetOutlookMailMessages.<>c__DisplayClass40_0.b__0()
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj) at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at UiPath.Mail.Activities.Extensions.TaskExtensions.TimeoutAfter[TResult](Task1 task, Int32 timeoutMs)
at UiPath.Mail.Activities.GetMailActivity.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Mail.Activities.BaseMailAsyncActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

If this is intermittent then their could be possibility of network issue.

Try putting this logic in retry scope.

@Sriram_Kancharla

  1. Increase the timeout value and check as when mails are huge it might take time
  2. Use a retry scope with a small delay to ensure any exception will be retried as it is intermittent

Cheers