Getting info from selected mail item in Outlook 2010

筅森魡賤 提交于 2019-12-05 21:50:22

The ActiveInspector() is the window that opens when the user double-clicks a mail item in the Explorer window. If the user is just viewing MailItems in the reading pane - you won't have an active inspector window (hence the NullReferenceException).

You are probably looking for the Explorer.Selection to get access to the currently selected MailItems.

 Outlook.Selection selection = this.Application.ActiveExplorer().Selection;

Globals.ThisAddIn.Application to get the Application object. That's probably your null reference, there is no Application object on "this" within the ribbon class.

here is the link that helped me a lot to sort out Outlook interop issues: http://msdn.microsoft.com/en-us/library/ff184621.aspx - and it does show how to enumerate currently selected items as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!