[Outlook] Add item to "New Items" popup menu

Add-in Express™ Support Service
That's what is more important than anything else

[Outlook] Add item to "New Items" popup menu
How to add item to existting menu or ribbon group 
Mykhaylo Boreyko


Guest


Hello.

I need some way to add menu item to "New Items" popup menu of Outlook 2007-2010. For example, user opens "New Items" and selects "Message to Mars". After that "New message" window opens with some custom parameters, i.e. To field = "Curiosity@mars.com", changed save folder, etc.

Can you help me with this? I'm new to Outlook development and haven't found anything similar on this forum.
Posted 15 Oct, 2012 03:29:15 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Mykhaylo,

Adding such an item to the main menu of Outlook 2007 is described in the manual, see the section "Step #9 ?Â?Ð?ã Customizing Main Menus in Outlook".

As to Outlook 2010, here are the settings of a Ribbon Context Menu component showing a Ribbon button right below the "E-mail message" item in the menu which drops down when you click the Ribbom button "New Items" in the Outlook 2010 Explorer window:

  object adxRibbonContextMenu1: TadxRibbonContextMenu
    ContextMenuNames.Strings = (
      'Outlook.Explorer.MenuMailNewItem')
    Left = 200
    Top = 304
    ControlTypes = {0100000007000000}
    Controls_ = <
      item
        Id = 'adxRibbonButton011D424FC61647BD8F1CBA5B9C5D1090'
        InsertAfterIdMso = 'NewMailMessageCompact'
        Caption = 'adxRibbonButton4'
        Ribbons = [msrOutlookExplorer]
        Ribbons2010 = [msrOutlookExplorer2010]
      end>
    Ribbons = [msrOutlookExplorer]
    Ribbons2010 = [msrOutlookExplorer2010]
  end


The strings 'MenuMailNewItem' and 'NewMailMessageCompact' are IDs of Ribbon controls built into Office; please check the section "Referring to Built-in Ribbon Controls" in the manual on how to find these.

Does this work for you?


Andrei Smolin
Add-in Express Team Leader
Posted 15 Oct, 2012 05:14:14 Top
Mykhaylo Boreyko


Guest


Thank you for quick reply.
I have read manual and successfully added required item to "New Items" popup.

But now on item click I dont know how to open "New Message" window and customize some mail item properties.

I must use Inspector.Display method or something else?
Posted 15 Oct, 2012 06:02:52 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
You should have IMail: _MailItem and IDispatch: IDisp declared.

The you create an item first:
- IDisp := OutlookApp.CreateItem(...)
- IDisp := MAPIFolder.Items.Add(...)

Then you call e.g. IDisp.QueryInterface(IID__MailItem, IMail) and use IMail to specify e.g, IMail.Subject := 'my string'. When the item is ready, you call IMail.Display or IMail.GetInspector.Display. Pay attention that setting properties of the newly created Outlook item may require saving the item before you display it; please check this yourself.

Getting Help on COM Objects, Properties and Methods
To get assistance with host applications?Â?Ð?é objects, their properties, and methods as well as help info, use the Object Browser. Go to the VBA environment (in the host application, choose menu Tools | Macro | Visual Basic Editor or just press {Alt+F11}), press {F2}, select the host application in the topmost combo and/or specify a search string in the search combo. Select a class /property /method and press {F1} to get the help topic that relates to the object.


Hope this helps.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Oct, 2012 06:27:28 Top