Search code examples
c#outlookconsoleoffice-interop

Outlook Interop Security


I am writing a C# Console application which shall be able to search through my emails.

I use the Interop Outlook dll to connect and can access the emails fine, but I always get a popup windows which asks me if I want to allow access to Outlook.

I understand that this is a secruity dialog and is needed so viruses cannot access my mails. I have already written an Outlook Add In in the past and never got the dialog. I guess this is because the code was executing from inside Outlook.

Is there any possibility do store my console app id and always grant access?

If there is no way around the dialog, is there any other way to search my local emails withing a C# console application?

The Systems specs are: Server 2012 R2 Datacenter, Visual Studio 2013 update 4 and Outlook 2013


Solution

  • You see the standard security prompt in Outlook. You can do the following to avoid it:

    1. Use the Security Manager component for supressing the security prompts in Outlook.

    2. Use a low-level API which doesn't generate such security prompts - Extended MAPI. Or any other third-party wrappers around that API such as Redemption.

    3. Deploy Outlook security settings (for administrators).

    You can read more about all of these ways on the Outlook "Object Model Guard" Security Issues for Developers page.