Determine the Item that was right-clicked in the item context menu for Ribbon command event
-
sábado, 03 de marzo de 2012 13:10
Does anyone know how to determine which Item was right-clicked on the context menu in the case of a re-purposed idMso command in Outlook 2010? E.g. a user right-clicks on a MailItem and selects Reply. This fires a repurposed onAction handler for the idMso="Reply" command. The handler then needs to identify the Item that was right-clicked (i.e. the item that is being replied to).
Currently I use the following Ribbon XML:
<commands> <command idMso="Reply" onAction="myReply" /> </commands>And the corresponding onAction handler:
public void myReply(Office.IRibbonControl control, ref bool cancelDefault) { if (control.Context is Outlook.Explorer) { Outlook.Explorer explorer = control.Context as Outlook.Explorer; HandleReplyEvent(explorer.Selection[1]); } cancelDefault = false; }The problem is that when the command is raised from the context menu, control.Context is still an Explorer object. BUT, explorer.Selection[1] is not necessarily the item that was right clicked (since right-clicking an item in Outlook 2010 does not select it).
Note that this is not the case of adding a new context menu command but re-purposing an existing command that is then selected through an item context menu. (In the case of adding a context menu command, the items that were right clicked are explicitly passed in the control.Context as an Outlook.Selection).
- Editado Hamish Anderson domingo, 04 de marzo de 2012 0:41
Todas las respuestas
-
lunes, 05 de marzo de 2012 5:57Moderador
Hi Hamish,
Thanks for posting in the MSDN Forum.
That just like you mentioned. Outlook PIA doesn't provide any ways to handle such kind of issue. I will involve some experts into this issue to see whether they are able to solve it. There might be some time delay, appreciate for your patience.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
- Marcado como respuesta Hamish Anderson jueves, 08 de marzo de 2012 16:51
-
lunes, 05 de marzo de 2012 9:14Thanks for the response, Tom.

