我正在为outlook创建以下加载项:
它由:
组成点击按钮后如何获得该联系人的参考?
这就是我的尝试:
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
}
答案 0 :(得分:2)
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);
}
}