A
Adi
Hi,
I am trying to send a meeting programmatically using following code:
try
{
// Create the Outlook application.
Outlook.Application oApp = new Outlook.Application();
// Get the NameSpace and Logon information.
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
// Log on by using a dialog box to choose the profile.
oNS.Logon(Type.Missing, Type.Missing, true, true);
// Create a new appointment item.
Outlook.AppointmentItem oMsg =
(Outlook.AppointmentItem)oApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
// Set the subject.
oMsg.Subject = "Send Using OOM in C#";
// Add a recipient.
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip =
(Outlook.Recipient)oRecips.Add("(e-mail address removed)");
oRecip.Resolve();
// Send.
oMsg.Send();
// Log off.
oNS.Logoff();
// Clean up.
oRecip = null;
oRecips = null;
oMsg = null;
oNS = null;
oApp = null;
}
// Simple error handling.
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}
When the "oMsg.Send()" is called, Outlook pops open a dialog box with
the following message:
"A program is trying to automatically send e-mail on your behalf. Do
you allow this?..."
Since our requirement is to send meeting automatically behind the
scene, we do not want to have this dialog box pop-up everytime we send
a meeting request.
Is there a way to bypass this message box?
Your help would really be appreciated. Thanks a lot.
Thanks,
Aditya
I am trying to send a meeting programmatically using following code:
try
{
// Create the Outlook application.
Outlook.Application oApp = new Outlook.Application();
// Get the NameSpace and Logon information.
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
// Log on by using a dialog box to choose the profile.
oNS.Logon(Type.Missing, Type.Missing, true, true);
// Create a new appointment item.
Outlook.AppointmentItem oMsg =
(Outlook.AppointmentItem)oApp.CreateItem(Outlook.OlItemType.olAppointmentItem);
// Set the subject.
oMsg.Subject = "Send Using OOM in C#";
// Add a recipient.
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip =
(Outlook.Recipient)oRecips.Add("(e-mail address removed)");
oRecip.Resolve();
// Send.
oMsg.Send();
// Log off.
oNS.Logoff();
// Clean up.
oRecip = null;
oRecips = null;
oMsg = null;
oNS = null;
oApp = null;
}
// Simple error handling.
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}
When the "oMsg.Send()" is called, Outlook pops open a dialog box with
the following message:
"A program is trying to automatically send e-mail on your behalf. Do
you allow this?..."
Since our requirement is to send meeting automatically behind the
scene, we do not want to have this dialog box pop-up everytime we send
a meeting request.
Is there a way to bypass this message box?
Your help would really be appreciated. Thanks a lot.
Thanks,
Aditya