'Automatically Allow Programmatic Access to Outlook

There is a Public Shared Folder that exists on a corporate exchange server.

I am trying to connect to the outlook folder, and monitor it for incoming mail.

However, When I connect, my local instance of Outlook prompts me for permission.

Is there anyway to circumvent this prompt?

I tried adding relevant MAPI registry values, but it is still prompting.

Any thoughts?

Registry I am setting (python)

opened_key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Office\14.0\Outlook\Security')
winreg.SetValueEx(opened_key, 'PromptSimpleMAPISend', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptSimpleMAPINameResolve', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptSimpleMAPIOpenMessage', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptOomAddressBookAccess', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptOomFormulaAccess', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptOomSaveAs', 0, winreg.REG_DWORD, 2)

winreg.SetValueEx(opened_key, 'PromptOomAddressInformationAccess', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptOomMeetingTaskRequestResponse', 0, winreg.REG_DWORD, 2)
winreg.SetValueEx(opened_key, 'PromptOomSend', 0, winreg.REG_DWORD, 2)

winreg.CloseKey(opened_key)


Solution 1:[1]

If you get prompt when reading the MailItem.Body property, your workarounds are listed at http://www.outlookcode.com/article.aspx?id=52.

The registry keys above will do nothing. Your options are Extended MAPI (C++ or Delphi only), MAPI wrapper such as Redemption (I am its author - Redemption can be accessed form Python) or an app like ClickYes.

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