Author: ashok.k | Posted on: 5/11/2009 5:28:34 AM | Views : 329


Hi

  I am reading the mails in the Outlook inbox folder using the Following code.

oOutlook = new Microsoft.Office.Interop.Outlook.Application();
oNs = oOutlook.GetNamespace("MAPI");
//getting mail folder from inbox
oFldr = oNs.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

foreach (Outlook.MailItem oMessage in oFldr.Items)
{
strSubject =  oMessage.Subject.ToString();
strBody=oMessage.Body.ToString();
}

I get an alert message as follows:

A program is trying is access e-mail addresses you have stored in Outlook.Do you want to allow this?

If this is unexpected, it may be a virus and you should choose "No".

Allow access for .....1 minute


Yes  No   Help

 Only when i click yes, the program is able to read the mails. I want to access the mails without this confirmation.

Is it possible to skip this aler ...

Go to the complete details ...