views:

18

answers:

1

I'm trying to get the contacts from Outlook (2007) using the following code:

Outlook.Application outlookApp = new Outlook.Application();
Outlook.MAPIFolder fldContacts = outlookApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts) as Outlook.MAPIFolder;
foreach (Outlook._ContactItem contact in fldContacts.Items) {...}

The problem is that I get a warning from Outlook when I try to get the email address, something like that:

A program is trying to access e-mail address information stored in Outlook.
If this is unexpected, click Deny and verify your antivirus software is up-to-date.
For more information about e-mail safety and how you might be able to avoid getting this warning, click Help.

I would like the user to have a clean experience (this fetch is for adding new friends to the application based on their mail addresses). Skype manages to do that without Outlook asking the user to approve. The solutions I have found thus far by uncle Google turned out to be mostly dirty hacks, and I'm wondering if there's a clean way to do it.

Ideas?

+1  A: 

Hi Eldad,

A nice clean way to avoid the Outlook warning is using Add-in Express's Outlook Security Manager. It's really easy to use:

SecurityManager.DisableOOMWarnings = true; 

Kind Regards

Pieter

Pieter
Great! Just what I needed. Thanks.
Eldad Mor