I am working on a python for outlook. It connects through a win32com.client. I am trying to check whether the ActiveWindow in Outlook is a Mail in its own Window(Inspector) or the Preview inside the Mainwindow (Explorer). In VBA this is checked like here:
Dim curremail As Outlook.MailItem
Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set curremail = Application.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set curremail = Application.ActiveInspector.CurrentItem
End Select
Unfortunately, the I don't know how to get the TypeName. The python type() returns <class 'win32com.client.CDispatch'> not the type of the ActiveWindow. Does anyone have an idea how to get the VBA TypeName, or if that is not possible how to determine whether the Mail is opened in the preview or its own window?
import win32com.client as client
outlook = client.Dispatch('Outlook.Application')
print(outlook.Inspectors.Count) #Can Determine the amount of open windows, but not if one is active
print(outlook.Inspectors.Item(1).Caption) #Caption of the first open window
print(outlook.ActiveWindow())
print(type(outlook.ActiveWindow()))