"Use Desktop Outlook App" Fails with CO_E_SERVER_EXEC_FAILURE (0x80080005) – COM Elevation Mismatch
Issue Description
Applies To
Products: UiPath Studio/Robot/Assistant with Classic Outlook
Package: UiPath.Mail.Activities
Activity: Use Desktop Outlook App
Error details
Source: Use Desktop Outlook App
Message: Could not connect to Outlook. Please try to run both programs as Administrator (or not as Administrator). If the error persists this might be due a corrupt Office installation. Please repair Office installation.
Exception Type: System.SystemException
Stack Trace
25.10.8+Branch.support-v25.10.Sha.407e50cb1ec6b2deb9870a77eeaf7566372717b4.407e50cb1ec6b2deb9870a77eeaf7566372717b4Source: Use Desktop Outlook App
Message: Could not connect to Outlook. Please try to run both programs as Administrator ( or not as Administrator).
If the error persists this might be due an corrupt Office installation. Please repair Office installation.Exception Type: System.SystemException
in Main.xaml
at OutlookApplicationCard "Use Desktop Outlook App"
at Sequence "Main Sequence"
at Main "Main"
System.SystemException: Could not connect to Outlook. Please try to run both programs as Administrator ( or not as Administrator).
If the error persists this might be due an corrupt Office installation. Please repair Office installation.
—> System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
at UiPath.Mail.OutlookAPI.<>c.<.cctor>b__41_0()
at UiPath.Mail.OutlookAPI.GetApp()
at UiPath.Mail.OutlookAPI.InitOutlook()
— End of inner exception stack trace —
at UiPath.Mail.OutlookAPI.InitOutlook()
at UiPath.Mail.Outlook.OutlookAccountWithStoreDetectionService.GetLocallyMappedStoreAccounts()
at UiPath.Mail.Outlook.OutlookAccountWithStoreDetectionService.GetAccountInformation(String accountWithStoreName)
at UiPath.Mail.Activities.Business.OutlookApplicationCard.ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken)
at UiPath.Shared.Activities.AsyncTaskNativeImplementation.Execute(NativeActivityContext context, Func`3 onExecute, BookmarkCallback callback)
at UiPath.Shared.Activities.AsyncTaskNativeActivity.Execute(NativeActivityContext context)
at UiPath.Mail.Activities.BaseMailAsyncNativeActivity.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Root Cause
UiPath.Service.UserHost.exe and UiPath.Executor.exe are running in elevated mode (Administrator), while OUTLOOK.EXE is running as a standard user.
COM does not allow cross-integrity connections between processes at different privilege levels. As a result:
- Outlook’s COM objects are invisible to UiPath
- MAPI initialization fails
- UiPath cannot attach to an existing Outlook instance
Diagnosis - Registry Entry Causing the Problem
|
Registry Path |
HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers |
|
Name |
C:\Program Files\UiPath\Studio\UiPath.Service.UserHost.exe |
|
Value (problem) |
~ RUNASADMIN |
The RUNASADMIN flag forces UiPath.Service.UserHost.exe and UiPath.Executor.exe to elevate, creating the privilege mismatch with Outlook.
Resolution
Change the registry value from RUNASADMIN to RunAsInvoker.
Option 1 - PowerShell (Recommended)
Run Windows PowerShell ISE as the impacted user (do NOT run as Administrator):
New-ItemProperty `
-Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" `
-Name "C:\Program Files\UiPath\Studio\UiPath.Service.UserHost.exe" `
-Value "~ RunAsInvoker" `
-PropertyType String `
-Force
Option 2 - Manual via Registry Editor
Registry Path: HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
Name: C:\Program Files\UiPath\Studio\UiPath.Service.UserHost.exe
Value: ~ RunAsInvoker
Ensure that no UiPath.Service.UserHost.exe or UiPath.Executor.exe processes are running in Task Manager for the affected robot user. If any are found, end those processes.
Afterward, retry running a new Studio project or Robot process. This should resolve the elevation mismatch.
Effect of RunAsInvoker
RunAsInvoker forces the executable to run with the same privilege level as the parent process, even if the executable would otherwise auto-elevate or a manifest requests admin rights.
What Changes in Practice?
- UiPath.Service.UserHost.exe and UiPath.Executor run as a standard user
- No UAC elevation boundary is crossed
- Outlook and UiPath run at the same integrity level
- COM registration becomes visible
- Outlook profile loads correctly
- Marshal.GetActiveObject("Outlook.Application") succeeds
Setting Comparison
|
Setting |
Result |
|
~ RUNASADMIN |
Breaks Office/COM automation (elevation mismatch) |
|
~ RunAsInvoker |
Preserves COM compatibility (same integrity level) |
Office automation should almost never run elevated. Microsoft Office apps are designed to be automated within the same user context, not across elevation boundaries.
This Fix Typically Resolves
- "Could not connect to Outlook"
- Outlook scope failing to initialize
- Intermittent Office/COM automation failures
When This Fix Will NOT Help?
This fix is effective only if the issue is privilege-related.
It will not resolve:
- Corrupted Outlook profiles
- Missing or broken Office installation
- Bitness mismatch (32-bit Outlook vs 64-bit automation dependencies)
- Outlook already running elevated (rare but possible)
- Studio/Robot running as a service (Session 0)
Best Practice Recommendation
|
For Outlook and COM-based Office automation, all involved processes must run under the same user context and privilege level:
Forcing UiPath.Service.UserHost.exe to run with RunAsInvoker prevents elevation mismatches and avoids COM connection failures such as "Could not connect to Outlook". |



