requireAdministrator ExecutionLevel terminates Outlook access? RRS feed

  • Question

  • I'm working a windows application that uses C# managed code and Win32 pinvoke.

    Also, application uses Outlook (2007) references for sending mail.

    Application must use administrative permitions because it hooks to keyboard and mouse (Win32 pinvoke).

    So, I added in app.manifest "requestedPrivileges" node and manifest looks like:


    <?xml version="1.0" encoding="utf-8"?>
    <asmv1:assembly manifestVersion="1.0" xmlns="urnTongue Tiedchemas-microsoft-com:asm.v1" xmlns:asmv1="urnTongue Tiedchemas-microsoft-com:asm.v1" xmlns:asmv2="urnTongue Tiedchemas-microsoft-com:asm.v2" xmlns:xsi="
      <trustInfo xmlns="urnTongue Tiedchemas-microsoft-com:asm.v2">
            <defaultAssemblyRequest permissionSetReference="Custom" />
            <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>



    At the first, when I start application, Vista shows dialog:


    Caption: User Account Control

    An unidentified program wants to access to your computer

    Buttons: Cancel Allow


    After I click Allow button, application is working well, but, when I try to send mail it fails to start Outlook objects.

    If I clear "requestedPrivileges" from app.manifest I can send mail, but, (of course) Win32 hooking stops to work.




    P.S. My user account is at the local Administrative group

    Just before I use Outlook application object following methods:



    points to my correct current account.

    Tuesday, May 15, 2007 8:57 AM