I am creating the following add-in for outlook:
It is composed of:
How can I get a reference to that contact when I click on the button?
This is what I have tried:
private void button1_Click(object sender, RibbonControlEventArgs e)
{
Console.Write("Clicked");
Microsoft.Office.Interop.Outlook._Application a = new Application();
var currentView = a.ActiveExplorer().CurrentView;
// now how do I get the currect contact from the current view?
// currentView.ContactItem shows an error
}
private void button1_Click(object sender, RibbonControlEventArgs e)
{
Console.Write("Clicked");
var item = this.Context as Inspector;
if (item == null)
return;
var contactItem = item.CurrentItem as ContactItem;
if (contactItem != null)
{
// current contact on view
Console.WriteLine(contactItem.BusinessFaxNumber);
}
}