I created a test email program with C# and Outlook. I can't figure why I'm getting ambiguity errors with my program below.
Error 1 Ambiguity between 'Outlook._MailItem.Send()' and 'Outlook.ItemEvents_Event.Send' C:\Mail Blaster\Program.cs 25 23
I explictly state the type of my object. Any input would be appreciated.
Error 1 Ambiguity between 'Outlook._MailItem.Send()' and 'Outlook.ItemEvents_Event.Send' C:\Mail Blaster\Program.cs 25 23
I explictly state the type of my object. Any input would be appreciated.
Code:
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using Outlook;
#endregion
namespace Mail_Blaster
{
class Program
{
static void Main(string[] args)
{
try {
ApplicationClass outLookApp = new ApplicationClass();
MailItem myMail = (MailItem) outLookApp.CreateItem(OlItemType.olMailItem);
myMail.To = args[0];
myMail.Subject = "Test";
myMail.HTMLBody = "<STRONG>Test Mail</STRONG>";
myMail.Send();
}
catch
{
Console.WriteLine("Error sending mail");
}
}
}
}