WillShakespeare
MIS
Hi All,
I was reading through the article on the C# msdn home page about introducing the Outlook 2003 Object Model through C#.
I carefully programmed the OPine example, but after ironing out reference errors and syntax, etc., I finally had this one annoying error. I can see obviously what is causing it, but for the life of me can't figure out how to fix it!
Error:
Error 1 Ambiguity between
'Microsoft.Office.Interop.Outlook._MailItem.Send()' and
'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Send'
C:\Documents and Settings\rclements\Local Settings\Application Data\Temporary Projects\OPine\Program.cs 122 19
Here is the code reference:
public static void SendNewMail(ApplicationClass o)
{
// Create a new MailItem.
MailItem myMail =
(MailItem)o.CreateItem(OlItemType.olMailItem);
// Now gather input from user.
Console.Write("Receiver Name: ");
myMail.Recipients.Add(Console.ReadLine());
Console.Write("Subject: ");
myMail.Subject = Console.ReadLine();
Console.Write("Message Body: ");
myMail.Body = Console.ReadLine();
// Send it!
myMail.Send();
}
It is the method Send() in the last line of the static method which causes the error...
Can anyone help me compile this? How can I force it to choose the correct option?
Will
I was reading through the article on the C# msdn home page about introducing the Outlook 2003 Object Model through C#.
I carefully programmed the OPine example, but after ironing out reference errors and syntax, etc., I finally had this one annoying error. I can see obviously what is causing it, but for the life of me can't figure out how to fix it!
Error:
Error 1 Ambiguity between
'Microsoft.Office.Interop.Outlook._MailItem.Send()' and
'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Send'
C:\Documents and Settings\rclements\Local Settings\Application Data\Temporary Projects\OPine\Program.cs 122 19
Here is the code reference:
public static void SendNewMail(ApplicationClass o)
{
// Create a new MailItem.
MailItem myMail =
(MailItem)o.CreateItem(OlItemType.olMailItem);
// Now gather input from user.
Console.Write("Receiver Name: ");
myMail.Recipients.Add(Console.ReadLine());
Console.Write("Subject: ");
myMail.Subject = Console.ReadLine();
Console.Write("Message Body: ");
myMail.Body = Console.ReadLine();
// Send it!
myMail.Send();
}
It is the method Send() in the last line of the static method which causes the error...
Can anyone help me compile this? How can I force it to choose the correct option?
Will