How to add an Outlook VSTO 2010 context menu within the message?
I have an Outlook 2010 addin, and I'm trying to create a custom context menu item. Whenever the user is in the Message body and right clicks, I would like to have my addin do some action on the selected text. I have a Ribbon bar that already has the actions I want, But I have no idea how to actually create the context menu item. I've found a couple tutorials for MailItems, but they do not seem to work within the message body. I do not want to use IContextMenuDisplay, because it is deprecated.
Can anyone be of assistance?
I've found:
http://www.developerzen.com/2005/04/04/adding-a-button-to-outlooks-context-menu/ http://weblogs.asp.net/开发者_C百科avnerk/archive/2007/01/03/vsto-for-outlook-2007-building-the-add-in-part-2.aspx http://www.roelvanlisdonk.nl/?p=1184
Edit: I've realized that the message body is using the Word context menu, is this possible with word?
Use this as your custom context menu xml. I was confused because the idMso needed for the message body is ContextMenuText, instead of those dealing with outlook mailitems.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<contextMenus>
<contextMenu idMso="ContextMenuText">
<button idMso="FontDialog" visible="false" />
<toggleButton id="MyToggle" label="My Toggle Button" />
<button id="MyButton" label="My Button" insertBeforeMso="HyperlinkInsert" onAction="GetButtonID" />
<menuSeparator id="MySeparator" />
<menu id="MySubMenu" label="My Submenu" >
<button id="MyButton2" label="Button on submenu" />
</menu>
<gallery id="galleryOne" label="My Gallery">
<item id="item1" imageMso="HappyFace" />
<item id="item2" imageMso="HappyFace" />
<item id="item3" imageMso="HappyFace" />
<item id="item4" imageMso="HappyFace" />
</gallery>
<dynamicMenu id="MyDynamicMenu" label= "My Dynamic Menu" getContent="GetMyContent" />
</contextMenu>
</contextMenus>
</customUI>
精彩评论