none
C#- Invoke context menu item programmatically from outlook add-in RRS feed

  • Question

  • Hi,

    I have a custom context menu item called "Mycustomitem" (just like copy,reply item )on mail item of outbox and i want to programmatically click that item from my outlook add-in.I took the mail object using following code and tried to get any automatic action of click the context menu item on that mail but unfortunately i dint find any action on it.

    Outlook.MAPIFolder outbox = this.Application.ActiveExplorer().Session.
                 GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox);
     Outlook.MailItem outboxFirstmail = outbox.Items.GetFirst() as Outlook.MailItem;


    Can any one suggest me how i can do this in C#. I am struggling with this from past one month.


    • Edited by Soumya P C Friday, March 11, 2016 2:34 PM
    Friday, March 11, 2016 2:31 PM

Answers

  • As I wrote earlier, the Outlook object model doesn't provide anything for that. 

    Try to contact add-in developers, they may provide a public method which can be invoked. Or just use the late binding technology for calling the Click event handler programmatically (Reflection in .Net), see Type.InvokeMemeber  for more information.

    • Marked as answer by David_JunFeng Monday, March 21, 2016 2:18 PM
    Friday, March 11, 2016 4:59 PM

All replies

  • Hello Soumya,

    The Outlook extensibility model (nor Fluent UI) doesn't provide anything for that.

    What is the final goal of displaying a context menu?

    Friday, March 11, 2016 3:19 PM
  • On click of that menu item button, pop ups a window relating to another application.That is custom item which has been added from other add-in. I just have to invoke that programmatically from my outlook add-in.
    Friday, March 11, 2016 3:25 PM
  • As I wrote earlier, the Outlook object model doesn't provide anything for that. 

    Try to contact add-in developers, they may provide a public method which can be invoked. Or just use the late binding technology for calling the Click event handler programmatically (Reflection in .Net), see Type.InvokeMemeber  for more information.

    • Marked as answer by David_JunFeng Monday, March 21, 2016 2:18 PM
    Friday, March 11, 2016 4:59 PM