Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ambiguity problem

Status
Not open for further replies.

dontj

Programmer
Feb 8, 2005
5
0
0
US
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.



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");
            }
        }
    }
}
 
Code:
MailItem myMail = (MailItem) outLookApp.CreateItem
Try using the full namespace path on this line and see what happens.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top