Hi i want to add a new button to outlook 2013 mailitem contextmenu. I use VS 2012 C#.
I seached internet but cant find a way to do this, im upgrading an Outlook 2010 addin which modified the contextmenu.
In visual studio on project select add new item. Choose Ribbon(XML).
add following to XML file:
<contextMenus>
<contextMenu idMso="ContextMenuMailItem">
<menu id="ArcIT" label="ArcIT">
<button id="MyContextMenuMailItem"
label="ContextMenuMailItem"
onAction="OnMyButtonClick"/>
</menu >
</contextMenu>
</contextMenus>
in ribbon.cs class add following method
public void OnMyButtonClick(Office.IRibbonControl control)
{
if (control.Context is Outlook.Selection)
{
Outlook.Selection sel = control.Context as Outlook.Selection;
Outlook.MailItem mail = sel[1];
MessageBox.Show(mail.Subject.ToString());
}
}
method has to be public. This method shows a box with subject from the mail u right clicked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With