How do I turn the message off?

V

vincent

I get following message every time my program execute.

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

How do I turn the message off?

Following is the message
http://cid-29b22a6e2be1baca.skydrive.live.com/self.aspx/Public/outlook message.JPG

Following is my source code.
private void button_Start_Click(object sender, EventArgs e)
{
MAPI.Session oSession;

// Create session and logon
Object[] argsLogon = new Object[7];

oSession = new MAPI.Session();

// Will use vEmpty for Empty parameter
Object vEmpty = Missing.Value;

// Logon
oSession.Logon(vEmpty, vEmpty, false, false, vEmpty, vEmpty,
vEmpty);

// Get the folder
MAPI.Folder inboxFolder = oSession.Inbox as MAPI.Folder;

// Enumerate messages
MAPI.Messages messages = (MAPI.Messages)inboxFolder.Messages;
MAPI.Message message = (MAPI.Message)messages.GetFirst(null);
int findedCounter = 0;

while (message != null)
{
// do stuff with the message
if (GetRK(message.Text.ToString(), this.textBox_RK.Text))
{
findedCounter++;
this.label_Result.Text = "Found";
//display data
//DisplayData(message);
this.label_Subject.Text = message.Subject.ToString();
MAPI.AddressEntry Sender =
(MAPI.AddressEntry)message.Sender;
this.label_Sender.Text = Sender.Address.ToString();

MAPI.Recipient recipient;
int i = 1;
object index = i;
MAPI.Recipients Recipients =
(MAPI.Recipients)message.Recipients;
int totalRecipientCount = (int)Recipients.Count;
string recipients = string.Empty;

for (int j = 0; j < totalRecipientCount; j++)
{
recipient =
(MAPI.Recipient)Recipients.get_Item(index);
recipients = recipients + recipient.Name.ToString()
+ ", ";
i++;
index = i;
}
recipients = recipients.TrimEnd(',');
this.label_Recipients.Text = recipients;

this.label_Text.Text = message.Text.ToString();
}
message = (MAPI.Message)messages.GetNext();
}

if (findedCounter <= 0)
{
this.label_Result.Text = "not found";
}
}
 
V

vincent

Thank you for replying.
It helps a lot.

Ken Slovak - said:
CDO 1.21 code is never considered as secure and CDO is not at all supported
in managed code.

See http://www.outlookcode.com/article.aspx?id=52 for more information on
the Outlook security.




vincent said:
I get following message every time my program execute.

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

How do I turn the message off?

Following is the message
http://cid-29b22a6e2be1baca.skydrive.live.com/self.aspx/Public/outlook message.JPG

Following is my source code.
private void button_Start_Click(object sender, EventArgs e)
{
MAPI.Session oSession;

// Create session and logon
Object[] argsLogon = new Object[7];

oSession = new MAPI.Session();

// Will use vEmpty for Empty parameter
Object vEmpty = Missing.Value;

// Logon
oSession.Logon(vEmpty, vEmpty, false, false, vEmpty, vEmpty,
vEmpty);

// Get the folder
MAPI.Folder inboxFolder = oSession.Inbox as MAPI.Folder;

// Enumerate messages
MAPI.Messages messages = (MAPI.Messages)inboxFolder.Messages;
MAPI.Message message = (MAPI.Message)messages.GetFirst(null);
int findedCounter = 0;

while (message != null)
{
// do stuff with the message
if (GetRK(message.Text.ToString(), this.textBox_RK.Text))
{
findedCounter++;
this.label_Result.Text = "Found";
//display data
//DisplayData(message);
this.label_Subject.Text = message.Subject.ToString();
MAPI.AddressEntry Sender =
(MAPI.AddressEntry)message.Sender;
this.label_Sender.Text = Sender.Address.ToString();

MAPI.Recipient recipient;
int i = 1;
object index = i;
MAPI.Recipients Recipients =
(MAPI.Recipients)message.Recipients;
int totalRecipientCount = (int)Recipients.Count;
string recipients = string.Empty;

for (int j = 0; j < totalRecipientCount; j++)
{
recipient =
(MAPI.Recipient)Recipients.get_Item(index);
recipients = recipients + recipient.Name.ToString()
+ ", ";
i++;
index = i;
}
recipients = recipients.TrimEnd(',');
this.label_Recipients.Text = recipients;

this.label_Text.Text = message.Text.ToString();
}
message = (MAPI.Message)messages.GetNext();
}

if (findedCounter <= 0)
{
this.label_Result.Text = "not found";
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top