locked
Ambiguity between method 'Microsoft.Office.Interop.Outlook._MailItem.Send()' RRS feed

  • Question

  • I'm just getting started with Outlook and getting this warning:

    Ambiguity between method 'Microsoft.Office.Interop.Outlook._MailItem.Send()' and non-method 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Send'. Using method group.

    After searching the Internent, I've tried a few casts but cannot get rid of it.

    Thanks for any ideas,

    Dennis

     

    Thursday, July 22, 2010 11:50 AM

Answers

  • To call the Send() method of a MailItem without triggering that warning:
     

        ((Outlook._MailItem)mailItem).Send();

    --
    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

     
     
    "NDennisV" <=?utf-8?B?TkRlbm5pc1Y=?=> wrote in message news:9465d277-8a50-46ec-b39a-80e86dbfa471...

    I'm just getting started with Outlook and getting this warning:

    Ambiguity between method 'Microsoft.Office.Interop.Outlook._MailItem.Send()' and non-method 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Send'. Using method group.

    After searching the Internent, I've tried a few casts but cannot get rid of it.

    Thanks for any ideas,

    Dennis

     


    Ken Slovak MVP - Outlook
    • Marked as answer by NDennisV Thursday, July 22, 2010 1:54 PM
    Thursday, July 22, 2010 1:25 PM

All replies

  • See if this blog post by a member of the VSTO team clears things up for you: 

    Problems when a Method and Event name are the same when using C#
    http://blogs.msdn.com/b/eric_carter/archive/2004/09/20/231982.aspx

    Thursday, July 22, 2010 1:13 PM
  • To call the Send() method of a MailItem without triggering that warning:
     

        ((Outlook._MailItem)mailItem).Send();

    --
    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

     
     
    "NDennisV" <=?utf-8?B?TkRlbm5pc1Y=?=> wrote in message news:9465d277-8a50-46ec-b39a-80e86dbfa471...

    I'm just getting started with Outlook and getting this warning:

    Ambiguity between method 'Microsoft.Office.Interop.Outlook._MailItem.Send()' and non-method 'Microsoft.Office.Interop.Outlook.ItemEvents_10_Event.Send'. Using method group.

    After searching the Internent, I've tried a few casts but cannot get rid of it.

    Thanks for any ideas,

    Dennis

     


    Ken Slovak MVP - Outlook
    • Marked as answer by NDennisV Thursday, July 22, 2010 1:54 PM
    Thursday, July 22, 2010 1:25 PM
  • Thanks, ((Outlook._MailItem)mailItem).Send(); works.
    Thursday, July 22, 2010 1:55 PM
  • Thanks for asking the question. Exactly what I was looking for.  Tried Sue's refference but it's beyond my newbie understanding of vsto. 
    Monday, August 2, 2010 8:06 AM
  • You will end up casting around Send, Close, and Delete method...  You might as well just declare the object as _MailItem to be begin with.  

    Friday, August 2, 2013 12:15 PM