G
Guest
Following an intro article from the msdn homepage about using C# to access
the Outlook 2003 Object Model in Applications and Add-Ins, I came across a
problem with the OPine example.
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 (two methods with similar names is my guess),
but for the life of me can't figure out how to fix it! The code is EXACTLY as
out of the article...
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
the Outlook 2003 Object Model in Applications and Add-Ins, I came across a
problem with the OPine example.
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 (two methods with similar names is my guess),
but for the life of me can't figure out how to fix it! The code is EXACTLY as
out of the article...
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