OOM & VSTO : How to capture the current item from the active inspector?
One of my customer (developer) updated and created an Outlook 2007 Add-in (VSTO). He want to capture the current item from the active inspector?
In order to capture the current item from the active inspector you can use “OutlookSession.ActiveInspector.CurrentItem”. It will like this,
'[VB.Net: Code Snippet]
...
'Declaration part
Dim ThisOutlookSession As Outlook.Application = New Outlook.Application
Dim NS As Outlook.NameSpace = ThisOutlookSession.Session
...
'Implement your business logic, if you have any
...
'Find whether the active window is the Inspector or not
If TypeName(ThisOutlookSession.ActiveWindow) = "Inspector" Then
Msgbox(ThisOutlookSession.ActiveInspector.CurrentItem.Subject)
End if
...