AttachmentContextMenuDisplay with Outlook 2013

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

AttachmentContextMenuDisplay with Outlook 2013
 
Stan S




Posts: 184
Joined: 2007-09-04
Hi, AttachmentContextMenuDisplay event does not seem to work with Outlook 2013 32bit
I am using AddinExpress.MSO.2005 v 7.4.4067.2005

Is it something that you know about?

Stan
Posted 05 Jul, 2014 12:00:32 Top
Stan S




Posts: 184
Joined: 2007-09-04
ContextMenuClose won't work, too
I implemented workaround by tracking ExplorerSelectionChange, etc events
but I wonder if there's way to fix AttachmentContextMenuDisplay ?
Posted 05 Jul, 2014 12:28:10 Top
Andrei Smolin


Add-in Express team


Posts: 18852
Joined: 2006-05-11
Hello Stan,

In Outlook 2013 they've deleted all built-in Commandbars and commandbar controls completely. For this reason you cannot access and use built-in main menus, context menus, and toolbars in Outlook 2013. The AttachmentContextMenuDisplay and ContextMenuclose events are not supported in Outlook 2013 for the same reason.

You need to use the RibbonContextMenu component instead. You add a button to the menu and check all the required things in the PropertyChanging event of the button. An example demonstrating how to deal with selected attachments in Outlook 2013 (and 2010!) is given in section Determining a ribbon control's context at http://www.add-in-express.com/docs/net-ribbon-components.php.


Andrei Smolin
Add-in Express Team Leader
Posted 07 Jul, 2014 09:00:44 Top
Stan S




Posts: 184
Joined: 2007-09-04
Hi Andrei, thanks for your answer. I had implemented exactly that... However, looks like PropertyChanging is not firing when user rightclicks to pop up ribboncontextmenu. Is that correct? What i was trying to achieve is to hide or show commands from context menu dynamically. Right now, I am still able to do that as I am tracking all relevant XXX_Activate events. But I was wondering if there's better way to do that with OL2013.

Stan
Posted 07 Jul, 2014 13:36:37 Top
Andrei Smolin


Add-in Express team


Posts: 18852
Joined: 2006-05-11
Stan,

You need to use the PropertyChanging event on the components added to the RibbonContextMenu component, not on the RibbonContextMenu component itself. In addition, you need to check the property being changed. Here's a raw sketch:

        private void adxRibbonButton1_PropertyChanging(object sender, ADXRibbonPropertyChangingEventArgs e) {
            if (e.PropertyType == ADXRibbonControlPropertyType.Visible) {
                bool result = false;
                object context = e.Context;
                if (context != null) {
                    if (context is Outlook.AttachmentSelection) {
                       //... set result
                    }
                    Marshal.ReleaseComObject(context);
                }
                e.Value = result;
            }
        }



Andrei Smolin
Add-in Express Team Leader
Posted 08 Jul, 2014 05:31:08 Top
Stan S




Posts: 184
Joined: 2007-09-04
That explains it and it works! Thank you for the excellent support - as always!
Stan
Posted 08 Jul, 2014 10:47:01 Top
Andrei Smolin


Add-in Express team


Posts: 18852
Joined: 2006-05-11
You are welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 09 Jul, 2014 05:19:05 Top