PC Review


Reply
Thread Tools Rate Thread

Need to suppress Outlook message on msg.Send()

 
 
Adi
Guest
Posts: n/a
 
      3rd Jul 2008
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 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
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      3rd Jul 2008
See http://www.outlookcode.com/article.aspx?id=52 for your various options.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Adi" <(E-Mail Removed)> wrote in message
news:1630689f-947e-4c97-9677-(E-Mail Removed)...
> 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 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


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i suppress the message when trying to send mail from xcel =?Utf-8?B?c3Jp?= Microsoft Excel Misc 1 5th Jul 2006 08:32 PM
How to suppress an Outlook warning message? Dean Slindee Microsoft VB .NET 1 8th Sep 2005 07:28 AM
Suppress warning message in Outlook VBA email send richardconers@yahoo.com Microsoft Outlook VBA Programming 1 12th Dec 2004 09:24 AM
Send Error - Outlook doesn't send message in Outbox Dan Mabbutt Microsoft Outlook Discussion 1 6th Oct 2004 05:31 PM
Boring message in outlook when trying to send email by vba using item.send property !!!! Gorgo Microsoft Outlook VBA Programming 1 7th Mar 2004 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:13 PM.