Contextmenu in Outlook 2010

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

Contextmenu in Outlook 2010
 
Hannes Koidl




Posts: 320
Joined: 2008-05-19
Hi Guys,

prior to 2010 i had a contextmenu for MailItems - i added an popup there and i set BeforeID = 1 -> this way my contextmenu was always on top of all other - that worked very well. now in 2010 i dont get it work that my menu is always on top. i get it work for a single selected item - but if i select 2 or more items another contextmen? is shown and my ribbon is not on top anymore. currently i set the id to 10

this.m_popupContextMenu.BeforeID = 19;

means it is always on top of "Copy" - if i set the id to 1 - the item either dont appear at all or it aprear on the bottom.

any way to solve that?
Posted 14 Apr, 2010 17:45:38 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Hannes,

I've just tested a sample project that uses the ADXRibbonContextMenu introduced in Add-in Express for Office and .NET 2010 with the following settings:

        private AddinExpress.MSO.ADXRibbonContextMenu adxRibbonContextMenu1;
        private AddinExpress.MSO.ADXRibbonButton adxRibbonButton1;
...
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.adxRibbonContextMenu1 = new AddinExpress.MSO.ADXRibbonContextMenu(this.components);
            this.adxRibbonButton1 = new AddinExpress.MSO.ADXRibbonButton(this.components);
            // 
            // adxRibbonContextMenu1
            // 
            this.adxRibbonContextMenu1.ContextMenuNames.AddRange(new string[] {
            "Outlook.Explorer.ContextMenuMailItem"});
            this.adxRibbonContextMenu1.Controls.Add(this.adxRibbonButton1);
            this.adxRibbonContextMenu1.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer;
            // 
            // adxRibbonButton1
            // 
            this.adxRibbonButton1.Caption = "adxRibbonButton1";
            this.adxRibbonButton1.Id = "adxRibbonButton_fdcb513269c74b1faa8f49ec1dd952cb";
            this.adxRibbonButton1.ImageTransparentColor = System.Drawing.Color.Transparent;
            this.adxRibbonButton1.InsertBeforeIdMso = "Copy";
            this.adxRibbonButton1.Ribbons = AddinExpress.MSO.ADXRibbons.msrOutlookExplorer;
            // 
            // AddinModule
            // 
            this.AddinName = "MyAddin132";
            this.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook;

        }


For me, this adds the button before the Copy command in the item context menu in Outlook 2010. Does the same approach work for you?


Andrei Smolin
Add-in Express Team Leader
Posted 16 Apr, 2010 06:45:56 Top
Hannes Koidl




Posts: 320
Joined: 2008-05-19
Hi Andrei,

well, of course this works, but as i wrote now in 2010 i have the problem if i select 2 or more items there is another context menu, ContextMenuMultipleItems -> and here my Item is placed in second place if i use Copy as InsertBeforeId.

So how to solve it in 2010? Till 2007 i had set BeforeId = 1 - worked like a charm.

Next Question is why i cannot use my "old" contextmenu anymore? That would mean i need to use now my ADXContextMenu now for 2000 - 2007, and add an similar ADXRibbonContextMenu for 2010 -> would mean i need to duplicate my code?

Thx for your help Andrei!
Posted 26 Apr, 2010 13:46:20 Top
Hannes Koidl




Posts: 320
Joined: 2008-05-19
Seems this problem is similar to my problem?

http://www.add-in-express.com/forum/read.php?FID=5&TID=6904
Posted 26 Apr, 2010 14:37:14 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hi Hannes,

In Outlook 2000-2007, you use command bar based context menus (implemented with the ADXContextMenu component), whence BeforeID. In Outlook 2010, they allow you to use both command bar and Ribbon context menus. But in Outlook 2010 Beta, you are unable to position a command bar context menu item: whatever you do, it is shown below other context menu items. I cannot tell you if the issue exists in Outlook 2010 RTM because I haven't tested it yet. The workaround is to add extra ADXRibbonContextMenu and to show your button for ContextMenuMultipleItems. Note that you can use the existing event handler for the new button, too.


Andrei Smolin
Add-in Express Team Leader
Posted 27 Apr, 2010 06:07:34 Top
J. C




Posts: 1
Joined: 2010-05-26
I was working on this problem too, and here is what I came up with.


<contextMenus>
	<contextMenu idMso="ContextMenuMailItem">
		<button id="MyBtn1" label="My Button1" insertBeforeMso="Copy" />
		<menuSeparator id="MySeparator1" insertBeforeMso="Copy" />
	</contextMenu>
	<contextMenu idMso="ContextMenuMultipleItems">
		<button id="MyBtn2" label="My Button2" insertBeforeMso="OpenSelectedItems" />
		<menuSeparator id="MySeparator2" insertBeforeMso="OpenSelectedItems" />
	</contextMenu>
</contextMenus>


this will work for single item or multiple items.
Hope this help.
-jc
Posted 26 May, 2010 11:15:36 Top
Eugene Astafiev


Guest


Hi J. C,

Thank you for sharing your knowledge ;-)
Posted 26 May, 2010 11:28:36 Top