How to avoid Outlook security alert when reading outlook message from C# program

后端 未结 7 538
终归单人心
终归单人心 2020-12-05 11:30

I have a requirement of reading subject, sender address and message body of new message in my Outlook inbox from a C# program. But I am getting security alert \'A Program is

相关标签:
7条回答
  • 2020-12-05 11:57

    We use Advanced Security for Outlook from Mapilab for this. It is free, also for commercial use, and still keeps Outlook safe (by only allowing access from approved applications). Just apposed to previously mentioned solutions that cost either money, or may compromise security.

    0 讨论(0)
  • 2020-12-05 11:58

    "But I am looking for a solution which don't require any third party COM library."

    You won't find it. Kasper already pointed out the only solution that I know of. Redemption has been the only thing that has kept the Outlook plug-ins and code to work. I have done commercial Outlook add-ins for Franklin Covey. We explored a lot things, but Redemption was the only thing that got us over this hurdle.

    0 讨论(0)
  • 2020-12-05 12:00

    If your application is not a Outlook plug in you can look at MAPI to read data from the inbox

    0 讨论(0)
  • 2020-12-05 12:01

    Try this

    Tools-->Macro-->Security-->Programmatic Access

    Then choose Never warn me about suspicious activity.

    0 讨论(0)
  • 2020-12-05 12:09

    Sorry, I have had that annoying issue in both Outlook 2003 and Outlook 2007 add-ins, and the only solution that worked was to purchase a Redemption license. In Outlook 2007 that pesky popup should only show up if your firewall is down or your anti-virus software is outdated as far as I recall.

    0 讨论(0)
  • 2020-12-05 12:16

    I ran into same issue while accessing sender email address for outlook mail item. To avoid 'security alert' do not create new Application object, instead use Globals.ThisAddIn.Application to create new mailitem.

    string GetSenderEmail(Outlook.MailItem item)
        {
            string emailAddress = "";
            if (item.SenderEmailType == "EX")
            {
                Outlook.MailItem tempItem = (Outlook.MailItem)Globals.ThisAddIn.Application.CreateItem(Outlook.OlItemType.olMailItem);
                tempItem.To = item.SenderEmailAddress;
                emailAddress = tempItem.Recipients[1].AddressEntry.GetExchangeUser().PrimarySmtpAddress.Trim();
    
            }
            else
            {
                emailAddress = item.SenderEmailAddress.Trim();
    
            }
    
            return emailAddress;
        }
    
    0 讨论(0)
提交回复
热议问题