I want to select a mailItem from my outlook add-in. I know how to display a mailitem from c# but I need to select it inside the outlook window itself.
Display a mailitem:
mailItem.Display();
I am using the Outlook 2010 Add-in.
Anybody has any idea on how to do this?
Use
Explorer.ClearSelection()
and thenExplorer.AddToSelection()
. You should useExplorer.IsItemSelectableInView()
before callingAddToSelection()
to ensure the item you want to select exists in the current explorer view.Application.ActiveExplorer()
will give you the current active explorer if it exists.Here is a sample snippet taken from here (slightly modified to check
IsItemSelectableInView
).To change the current
Explorer
view you can useExplorer.CurrentFolder
orExplorer.CurrentView