Explorer.ActiveInlineResponse vs. AdxOutlookAppEvents.ExplorerInlineResponse

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

Explorer.ActiveInlineResponse vs. AdxOutlookAppEvents.ExplorerInlineResponse
 
Subscribe
Sébastien Lange




Posts: 25
Joined: 2022-09-21
Hi,

I have a weird behavior of Explorer.ActiveInlineResponse in a specific situation while listening to SelectionChange events (actually ADXOlForm.ADXSelectionChange):
Select an email in explorer, then start replying to the email (Explorer.ActiveInlineResponse is set), then select another email, then select again the ActiveInlineResponse... Explorer.ActiveInlineResponse is null at the time of SelectionChange event ("bug 1") while it shouldn't and Explorer.Selection returns the original email.
If I click again on the reply, then Explorer.ActiveInlineResponse is now correct...
If I do not click again on the reply, but click on another email ("bug 2")... ActiveInlineResponse is now set, while it shouldn't and I again get a wrong selection.

I discovered that AdxOutlookAppEvents has ExplorerInlineResponse event.
So if I listen to AdxOutlookAppEvents.ExplorerSelectionChange and AdxOutlookAppEvents.ExplorerInlineResponse, when selecting the reply in the specific situation above, I receive twice the ExplorerSelectionChange (and Explorer.ActiveInlineResponse is wrong at this time), then I receive ExplorerInlineResponse with the correct itemObject. And if I check ActiveExplorer.ActiveInlineResponse at this time, it's now correct...
So I could get the right selected item in "bug 1" situation. But still I don't know how to get it right in "bug 2" situation (except maybe if I ignore Explorer.ActiveInlineResponse and check only Explorer.Selection).

So what's the best way to have consistently the correct selected item in any situation?
Can I do something to get correct ActiveInlineResponse in any SelectionChange event?
Or should I listen to ExplorerInlineResponse to get notified of this special selection change (and ignore Explorer.ActiveInlineResponse in SelectionChange events) ? In this case, will ExplorerInlineResponse event always be fired after any SelectionChange?

Best regards,
Sébastien
Posted 07 Nov, 2022 08:47:42 Top
Andrei Smolin


Add-in Express team


Posts: 18506
Joined: 2006-05-11
Hello Sébastien,

Sébastien Lange writes:
Can I do something to get correct ActiveInlineResponse in any SelectionChange event?


I suppose you see a flow of events and selecting occurs before the inline response editor opens. I expect that the editor closes before the next SelectionChange occurs but this requires checking.

I suppose you won't ever get an InlineResponse in the SelectionChange event. Instead, I suggest that you track AdxOutlookAppEvents.ExplorerInlineResponseEx and AdxOutlookAppEvents.ExplorerInlineResponseCloseEx events.

Sébastien Lange writes:
In this case, will ExplorerInlineResponse event always be fired after any SelectionChange?


These events are raised by Outlook. I expect that you will always get the ExplorerInlineResponseEx when Outlook opens the inline response editor.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 07 Nov, 2022 11:11:12 Top
Sébastien Lange




Posts: 25
Joined: 2022-09-21
Thanks for your answer.

Listening to AdxOutlookAppEvents.ExplorerInlineResponseEx works fine.
However when AdxOutlookAppEvents.ExplorerInlineResponseCloseEx is fired, (sourceObject as Explorer).ActiveInlineResponse is still set to the response (so it's being closed but not closed). So should I consider the event as a Closing rather than Closed event, and then ignore Explorer.ActiveInlineResponse? If I do that, I get the correct selection. Is it the best solution?

Best regards,
Sébastien
Posted 08 Nov, 2022 03:35:30 Top
Andrei Smolin


Add-in Express team


Posts: 18506
Joined: 2006-05-11
Hello Sébastien,

Sébastien Lange writes:
So should I consider the event as a Closing rather than Closed event, and then ignore Explorer.ActiveInlineResponse? If I do that, I get the correct selection. Is it the best solution?


I don't know. Maybe the pate at https://learn.microsoft.com/en-us/office/vba/api/outlook.explorer.inlineresponseclose can provide more information.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 08 Nov, 2022 05:19:11 Top