'How to handle security pop-up in outlook using C#

While Automating Outlook using Microsoft.Office.Interop.Outlook a security pop-u is getting displayed saying "A program is trying to access a email folders.......".

Please help how can we bypass/solve using C# without using 'Redemption' or by changing the security settings(do not have access).

P.S: could we use JavaScript executer to accept the alert box? Thanks in advance



Solution 1:[1]

You get a standard security prompt in Outlook.

There are several ways for supressing such prompts:

  1. Use a third-party components for supressing Outlook security warnings. See Security Manager for Microsoft Outlook for more information.

  2. Use a low-level API instead of OOM. Or any other third-party wrappers around that API, for example, Redemption.

  3. Develop a COM add-in which has access to the trusted Application object. And then communicate from a standalone application with an add-in using standard .Net tools (Remoting).

  4. Use group policy objects for setting up machines.

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eugene Astafiev