I've been developing a C# (WinForms) application that uses the Office 2007 PIAs to integrate with Outlook 2007. In my dev environment, UAC is disabled and all of my functionality works, but my test environment is Vista 32-bit with UAC enabled.
In the test environment, Outlook runs at medium integrity level by default (when started by the user). My application requires high integrity level (i.e. it presents a UAC prompt on startup). In this scenario, instantiating the Microsoft.Office.Interop.Outlook.Application
class from my application fails with a CO_E_SERVER_EXEC_FAILURE
(COMException
, HRESULT=0x80080005).
I can get around this problem in 2 ways:
- Ensure Outlook is not running when my application instantiates
Application
- this forces Outlook to run in high integrity mode, since the process that starts it is also running at high integrity. - Instruct Outlook to always run as Administrator (Compatibility tab).
It is worthwhile to note that the Word and Excel PIAs do not exhibit this problem.
Is there any way around this problem? My application cannot run at low integrity, but there is a chance that it could be adapted to run at medium integrity level - however, I can't work out how to do this. Can .NET executables even run in this mode?
Alternatively, is there some way to communicate with Outlook even while there are mismatched integrity levels? As i've said, Word and Excel seem to have no problem with this.