Outlook activities failed

Hello,

I’m facing the following error message when I try to send a message using Outlook method :


Source: Send Outlook Mail Message

Message: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).

Exception Type: System.InvalidCastException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidCastException: Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).
   at UiPath.Mail.Activities.SendMailActivity.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)

After some search I’m still unable to find the exact cause of this error…
Threads found on this forum or technet (this problem is related to Microsoft product, not limited to UIPath visibly) are not working.

Windows 7 64bits
Office 2013 64bits
UIPath 2018.4.4

Any idea to solve this issue ?

In the same time I tried to simply access to the mailbox using the activity Get Outlook Mail Messages. And this one failed with another message :


Source: Get Outlook Mail Messages

Message: The specified folder does not exist

Exception Type: System.ArgumentException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.ArgumentException: The specified folder does not exist
   at UiPath.Mail.Activities.GetMailActivity.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)

Here, visibly, UIPath can access to Outlook object but don’t recognize any folder name. I tried “Inbox”, “Boîte de réception” (as displayed in Outlook), “Sent”, “Draft” etc… Nothing work…

Thanks,
Boris

1 Like

Hi @Trracer,

Here is the working sample to read the inbox messages. it’s working for me

ReadMessages.xaml (6.1 KB)

Please try and let me know if it is working

1 Like

Please check if the folder name is correct in the Get Outlook Mail Message Properties pane.

1 Like

Hey @Trracer

Just Try to Reinstall Package. Then try.

Regards…!!
AKsh

1 Like

Hi HareeshMR,

Test failed with the same message :

Source: Get Outlook Mail Messages

Message: The specified folder does not exist

Exception Type: System.ArgumentException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.ArgumentException: The specified folder does not exist
   at UiPath.Mail.Activities.GetMailActivity.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)

I tried to access to Outlook via VBS and no problem in this case, I could access to “Inbox” or “Sent” folders for example. Could-it be something specific to .Net framework configuration ?

Hi Rahul_Pasupuleti,

I used the example, just like HareeshMR post-it, then tried also with different folders names. But nothing work…

Hi aksh1yadav,

What package about are you speaking ? Office ?
I tried to uninstall/install the Mail package in UIPath Studio but the problem still there…

Can you share your xaml file ?

Unfortunately as new comer I cannot upload file, so I copy/paste here the code :

It’s a test so the first activity is a “Get Outlook Mail Messages” (just drag/dropped on the Sequence). The second one (disabled actually) is my first attempt to send a mail using Outlook. I just change the To address field which is normally my email address :wink:

ReportExceptionByMail.xaml:

<Activity mc:Ignorable="sap sap2010 sads" x:Class="Sequence" this:Sequence.ProcessName="Test" this:Sequence.ExceptionMessage="Exception Message Test"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:this="clr-namespace:"
 xmlns:ui="http://schemas.uipath.com/workflow/activities"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <x:Members>
    <x:Property Name="ProcessName" Type="InArgument(x:String)" />
    <x:Property Name="ExceptionMessage" Type="InArgument(x:String)" />
  </x:Members>
  <mva:VisualBasic.Settings>
    <x:Null />
  </mva:VisualBasic.Settings>
  <sap2010:WorkflowViewState.IdRef>Sequence_2</sap2010:WorkflowViewState.IdRef>
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System.Activities</x:String>
      <x:String>System.Activities.Statements</x:String>
      <x:String>System.Activities.Expressions</x:String>
      <x:String>System.Activities.Validation</x:String>
      <x:String>System.Activities.XamlIntegration</x:String>
      <x:String>Microsoft.VisualBasic</x:String>
      <x:String>Microsoft.VisualBasic.Activities</x:String>
      <x:String>System</x:String>
      <x:String>System.Collections</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Diagnostics</x:String>
      <x:String>System.Drawing</x:String>
      <x:String>System.IO</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Net.Mail</x:String>
      <x:String>System.Xml</x:String>
      <x:String>System.Xml.Linq</x:String>
      <x:String>System.Windows.Markup</x:String>
      <x:String>UiPath.Core</x:String>
      <x:String>UiPath.Core.Activities</x:String>
      <x:String>UiPath.Mail.Outlook.Activities</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>WindowsBase</AssemblyReference>
      <AssemblyReference>PresentationCore</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>UiPath.UiAutomation.Activities</AssemblyReference>
      <AssemblyReference>UiPath.System.Activities</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>UiPath.Excel</AssemblyReference>
      <AssemblyReference>UiPath.Mail</AssemblyReference>
      <AssemblyReference>System.ValueTuple</AssemblyReference>
      <AssemblyReference>UiPath.Mail.Activities</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Sequence DisplayName="Send Exception message by mail" sap2010:WorkflowViewState.IdRef="Sequence_1">
    <ui:GetOutlookMailMessages Account="{x:Null}" Filter="{x:Null}" Messages="{x:Null}" TimeoutMS="{x:Null}" DisplayName="Get Outlook Mail Messages" GetAttachements="False" sap2010:WorkflowViewState.IdRef="GetOutlookMailMessages_2" MailFolder="Inbox" MarkAsRead="False" OnlyUnreadMessages="True" Top="30" />
    <ui:CommentOut DisplayName="Comment Out" sap2010:WorkflowViewState.IdRef="CommentOut_2">
      <ui:CommentOut.Body>
        <Sequence DisplayName="Ignored Activities" sap2010:WorkflowViewState.IdRef="Sequence_2">
          <ui:SendOutlookMail Account="{x:Null}" Bcc="{x:Null}" Cc="{x:Null}" MailMessage="{x:Null}" TimeoutMS="{x:Null}" Body="[String.Format(&quot;Error occured during process : {0}.{1}Reported error : {2}{1}&quot;, ProcessName, vbNewLine, ExceptionMessage)]" DisplayName="Send Outlook Mail Message" sap2010:WorkflowViewState.IdRef="SendOutlookMail_1" IsBodyHtml="False" IsDraft="False" Subject="[String.Format(&quot;[Robot] Exception occured during process [{0}]&quot;, ProcessName)]" To="my_address_pro@my_society.com">
            <ui:SendOutlookMail.Files>
              <scg:List x:TypeArguments="InArgument(x:String)" Capacity="0" />
            </ui:SendOutlookMail.Files>
          </ui:SendOutlookMail>
        </Sequence>
      </ui:CommentOut.Body>
    </ui:CommentOut>
    <sads:DebugSymbol.Symbol>d0ZDOlxVc2Vyc1xncm9zamJvXERvY3VtZW50c1xVaVBhdGhcQUFfQ2l0cml4XFJlcG9ydEV4Y2VwdGlvbkJ5TWFpbC54YW1sBwF+AZUBAQMBWAFdAQJIA1YOAgEBSQVJtAICAQNKBVQVAgECSa0CSbECAgEFSfQBSfsBAgEE</sads:DebugSymbol.Symbol>
  </Sequence>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="GetOutlookMailMessages_2" sap:VirtualizedContainerService.HintSize="416,22" />
      <sap2010:ViewStateData Id="SendOutlookMail_1" sap:VirtualizedContainerService.HintSize="314,145" />
      <sap2010:ViewStateData Id="Sequence_2" sap:VirtualizedContainerService.HintSize="478,613" />
      <sap2010:ViewStateData Id="CommentOut_2" sap:VirtualizedContainerService.HintSize="416,347" />
      <sap2010:ViewStateData Id="Sequence_1" sap:VirtualizedContainerService.HintSize="438,533">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>
1 Like

The xaml is still working for me.

Try reinstallling the mail activities (UiPath.Mail.Activities) again in the manage packages available at the top in the ribbon. And try the workflow i send earlier.

Have a look of this : https://www.uipath.com/kb-articles/outlook-email-automation

1 Like

I tried to uninstall/reinstall the package (v1.3.0) and the activities still failed :-/

There is probably something wrong on my computer that block the Outlook functionality to work well… But what…

There is no need to be admin to use this kind of functionality ? I’m (unfortunately) “standard” user and cannot change the configuration…

Hi @Trracer

Any chance you could registered a ticket with our technical support (if your are an Enterprise customer)?

It seems to be an obscure issue with the 64bit version of Office. I found this topic with some partial solutions:


(but it requires modifying your registry)

You can also try Googling for the error message, as it might not actually be related strictly to Studio but rather to your particular setup:

0x80040155
1 Like

Hello @loginerror,

Sorry for the delay.
Yes, I contact the support for this problem and tried anything I could to find a solution. But nothing worked…
No problem detected into the registry, full install of Office 2013 or repair didn’t changed anything.

So in a last attempt before adopting a “Plan B”, we installed UIpath onto a VM with Windows 10 + Office 2016.
And… Ok, one good news and one bad !

The good is that send a email activity is working now :slight_smile: So the problem was really linked to the installation of the system in my company. No idea on the root cause by the way…

The bad, yes because it cannot be so simple, there is a bug with the AV installed (Symantec Endpoint Protection) which is not recognized as a valid antivirus software. And for Outlook 2016, no valid antivirus imply no access to the mailbox without warning message asking the user to validate the access for a defined amount of time… Bad Symantec :-/

Anyway, thank you all for your answers !

2 Likes