How to modify attachment's local menu

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

How to modify attachment's local menu
 
kollanyipeter




Posts: 9
Joined: 2021-05-14
Hi,

if a received message has an attachment, how can I change the attachment's local menu? Can I find any help or a sample program for this?


Regards,

P?ter
Posted 03 Jun, 2021 09:13:37 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello P?ter,

Put a TadxRibbonContextMenu onto the add-in module, set the Ribbons property to msrOutlookMailRead and/or msrOutlookExplorer - this reflects the fact that the attachment context menu can be shown in explorer and mail read inspector windows - and use the ContextMenuNames property editor to add the 'Outlook.Explorer.ContextMenuAttachments' and 'Outlook.Mail.Read.ContextMenuAttachments' context menu names to the list of context menu names that will show custom control(s) specified in the Controls property.

Below is a TadxRibbonContextMenu showing a button on the ContextMenuAttachments context menu in explorer and mail read inspector windows in Outlook 2010+.

  object adxRibbonContextMenu1: TadxRibbonContextMenu
    ContextMenuNames.Strings = (
      'Outlook.Explorer.ContextMenuAttachments'
      'Outlook.Mail.Read.ContextMenuAttachments')
    Left = 80
    Top = 216
    ControlTypes = {0100000007000000}
    Controls_ = <
      item
        Id = 'adxRibbonButton50EB42B075B448A9849E9D866EA1250F'
        Caption = 'adxRibbonButton2'
        Ribbons = [msrOutlookMailRead, msrOutlookExplorer]
        Ribbons2010 = [msrOutlookExplorer2010]
      end>
    Ribbons = [msrOutlookMailRead, msrOutlookExplorer]
    Ribbons2010 = [msrOutlookExplorer2010]
  end


You can find context menu names and IDs of built-in Ribbon controls in the download at https://www.microsoft.com/en-us/download/details.aspx?id=36798.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Jun, 2021 02:18:54 Top
kollanyipeter




Posts: 9
Joined: 2021-05-14
Thank You, it works fine!

Just one more little help: when I click the button, from where can I know, which attachment file is the actual?

Regards,

P?ter
Posted 04 Jun, 2021 07:14:38 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello P?ter,

Event handlers of Ribbon components provide context objects. You get such an object via Control.Context. The context object in this case should be an Outlook.AttachmentSelection object; see https://docs.microsoft.com/en-us/office/vba/api/outlook.attachmentselection.


Andrei Smolin
Add-in Express Team Leader
Posted 04 Jun, 2021 10:06:51 Top
kollanyipeter




Posts: 9
Joined: 2021-05-14
Thank You, it works fine!
Posted 22 Jun, 2021 01:04:11 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2021 01:23:46 Top