none
Outlook security messagebox pops up when accessing emails RRS feed

  • Question

  • Hi.

    I am developing a custom application [not an add-in for Outlook] which will scan the "My Documents" folder and Microsoft Outlook for text files and word documents and also emails. The application will then create an index of the words used in the mail based on the number of repetitions. I have completed the cases of text files and word documents without any problem. But when I began to work with Microsoft Outlook, it started showing some Security dialogs saying 'A program is trying to access email address information...". I want to get rid of this annoying dialog as I am performing the indexing process in a background thread. And I can't use Redemption since if it is installed, other (malicious) apps can make use of it so that it suppresses the outlook security dialogs for all apps in a machine wide scope.

    The code I use for collecting the mail items is:

     

    //Creating an outlook instance
    Microsoft.Office.Interop.Outlook.Application outlookApp= new Microsoft.Office.Interop.Outlook.Application();
    
    //Creating an outlook namespace
    Microsoft.Office.Interop.Outlook.Namespace ns = outlookApp.GetNamespace("MAPI");
    ns.Logon(null, null, false, false);
    
    //Getting the inbox folder
    Microsoft.Office.Interop.Outlook.MAPIFolder outlookFolder = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
    
    //Getting emails from the inbox
    List<Microsoft.Office.Interop.Outlook.MailItem> mailList = (from Microsoft.Office.Interop.Outlook.MailItem mail in folder.Items.OfType<Microsoft.Office.Interop.Outlook.MailItem>()
                                                                             select mail).Take(500).ToList();
    
    //Do something with mail. Here gets the popup hooked up
    foreach(Microsoft.Office.Interop.Outlook.MailItem mail in mailList)
    {
    //do something with mail. eg: access mail.Body
    }
    
    I get the security message popped up at the statement where the mail is accessed. Is there any workaround for this? Since this is a background process, I don't want to make the user annoyed of repeated dialogs. Any possible way to get rid of this? Any help will greatly be appreciated.

     


    :RSMANU:


    Wednesday, February 1, 2012 6:11 AM

Answers

  • Redemption does not supress the security prompts for *all* apps. An app must explicitly use Redemption to work around the prompts by using Extended MAPI (which is not subject to the security prompts).

    See http://www.outlookcode.com/article.aspx?id=52 for the list of your options.

    Essentially making your code a COM add-in or using Extended MAPI (directly in C++ or Delphi or through Redemption) are your only options.

     


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Wednesday, February 1, 2012 2:14 PM

All replies

  • Installing valid antyvir that will be recognized by Windows Control Panel will solve the issue.

    Also regarding Redemption - you can use it without registering in registry as COM component available to everyone, but only as a private DLL in your deployment folder, see http://www.dimastr.com/redemption/security.htm#redemptionloader 

    Wednesday, February 1, 2012 9:03 AM
  • hi..

    Thank you Damien. I am not permitted to use third party assemblies in my app. Thank you for your time and concern. Is there any other solution for this problem?


    :RSMANU:
    Wednesday, February 1, 2012 10:00 AM
  • what about installing antyvir? is that also not an option?
    Wednesday, February 1, 2012 10:57 AM
  • Hi Damian.

    Did you mean installing an antivirus? If this is the solution, the customers will also required to do the same, right? I am pretty new to Office programming, particularly for Outlook development. All I have to do is to index the local documents and Outlook emails without interrupting the user in background. All other parts except the Outlook email indexing are working fine. The mail indexing part is feeling a little jerky as it shows the dialog for each mail processed and each session the application tries email indexing. Can you help please?


    :RSMANU:
    Wednesday, February 1, 2012 11:19 AM
  • Installing antyvir is one of the options to make it go away, there are free offers for that (for example from Microsoft) and yes, it is needed on machine that will run this code (so also your customer).
    • Marked as answer by Ananthan Unni Wednesday, February 1, 2012 11:53 AM
    • Unmarked as answer by Ananthan Unni Wednesday, February 1, 2012 12:24 PM
    Wednesday, February 1, 2012 11:45 AM
  • Hi..

    Thanks for the information. I need to have a discussion on this. As you informed, my developer machine is protected by Windows Live Essentials which doesn't pop the alert up. The test machine was not equipped with an antivirus software. Let me check. Will get back to you.

    Wednesday, February 1, 2012 11:53 AM
  • Redemption does not supress the security prompts for *all* apps. An app must explicitly use Redemption to work around the prompts by using Extended MAPI (which is not subject to the security prompts).

    See http://www.outlookcode.com/article.aspx?id=52 for the list of your options.

    Essentially making your code a COM add-in or using Extended MAPI (directly in C++ or Delphi or through Redemption) are your only options.

     


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.2 is now available!
    Wednesday, February 1, 2012 2:14 PM