Getting the mailitem by right clicking an email.

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

Getting the mailitem by right clicking an email.
 
Michiel


Guest


Hello,

I am overriding a button in the right-click context menu of an email in the explorer of Outlook 365.
I use the TadxRibbonCommand component for this which is working well, the OnAction event is called.
However, I now need to know which mailitem has been right clicked.

This mailitem is not the ActiveExplorer.Selection[1] item, so I need to find out which one is clicked really. I have been reading several articles and posts on the Add-in Express website with a similar issue, yet they refer to additional ribbon buttons. Not overriding one.
For example on: https://www.add-in-express.com/docs/net-ribbon-components.php a click event is referred to. Alas, the TadxRibbonCommand.OnAction event doesn't provide an IRibbonControl parameter.

I cannot use an event to try to get the context with for example the adxOutlookAppEvents1ItemContextMenuDisplay event. It doesn't fire. It looks like this has been so for almost 10 years now...
https://www.add-in-express.com/forum/read.php?FID=5&TID=11097

Is there perhaps an alternative method to get the mailitem on the right-clicked email? The only usable parameter in the OnAction event would maby be the Sender. But then, how to get to the mailitem?

Best regards,
Michiel
Posted 22 Mar, 2022 10:31:48 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Michiel,

This issue is filed in our issue-tracking DB under #21179. When it is fixed, you'll find this number in whatsnew.txt.

You can add a custom button to that context menu. In the PropertyChanging event of the button, if PropertyType is TadxRibbonControlPropertyType.rcptVisible, you get Context, try to cast it to {Outlook2000? Outlook2010?}.Selection, and get the selected items. The final step in your event procedure is make the button invisible: set Value := false.

To add a button to a context menu, you need to know the name of the context menu. Use the installer at https://www.add-in-express.com/creating-addins-blog/2015/04/15/creating-office-context-menu-addin/ to install a .NET based add-in that adds a button to every context menu in Office applications. Click the button and get the following info copied to the Clipboard: the context menu name and the type name of the context object.

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 23 Mar, 2022 06:11:31 Top
Michiel


Guest


Hello Andrej,

Many thanks for your workaround. It works!

Best regards,
Michiel
Posted 23 Mar, 2022 10:27:02 Top
Andrei Smolin


Add-in Express team


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

Regards from Poland (CET),

Andrei Smolin
Add-in Express Team Leader
Posted 24 Mar, 2022 04:06:57 Top