get form object shown in my inspector

Add-in Express™ Support Service
That's what is more important than anything else

get form object shown in my inspector
trying to get the ADXOlForm given an inspector object 
aweber




Posts: 83
Joined: 2013-11-21
I am trying to get the current instance of my ADXOlForm shown in a specific Inspector.

I have the actual Inspector object, and I therefore even have the MailItem contained within my Inspector. However, I'm having trouble getting access to my form, even knowing these facts.

I have tried this workaround:
Dim iFrm As Integer = AddinModule.CurrentInstance.AdxOlFormsManager1.Items(0).FormInstanceCount
For i As Integer = 0 To iFrm - 1
     Dim sfrm As ADXOlSwooperForm = TryCast(AddinModule.CurrentInstance.AdxOlFormsManager1.Items(0).FormInstances(i), ADXOlSwooperForm)
     If (sfrm IsNot Nothing) Then
         If (sfrm.InspectorObj Is m_Window) Then
             sfrm.ExtCorrespDate = m_dtCorrespDateGuess
             Exit For
        End If
    End If
Next

(And I would probably have to test if I need to release the sfrm.InspectorObj)
But that InspectorObj never == m_Window (which is the known, current Inspector).

I would have thought there would be an easy way to find all the ADXOlForm objects given an Outlook.Inspector? But even this workaround does not work...is there some way to compare Inspectors in that loop, and would that loop work in the first place? (the number returned for instance count seems correct)

Thanks,
AJ
Posted 21 Mar, 2017 16:33:32 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Aaron,

You can use the GetForm() method of the ADXOlFormsCollectionItem component. For example:

Dim sfrm As ADXOlSwooperForm = TryCast(AddinModule.CurrentInstance.AdxOlFormsManager1.Items(0).GetForm(m_Window), ADXOlSwooperForm)
Posted 22 Mar, 2017 04:41:44 Top
aweber




Posts: 83
Joined: 2013-11-21
That works perfectly and answers my question about how to get the correct form based when the Inspector or Explorer is known!

Thank you.
Posted 22 Mar, 2017 09:18:46 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Aaron,

You are welcome!
Posted 22 Mar, 2017 09:50:02 Top