Check if a MailItem is displayed in inspector or in preview (reading) pane

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

Check if a MailItem is displayed in inspector or in preview (reading) pane
 
Sagi




Posts: 4
Joined: 2020-07-15
Hi,
We listen to
AppEvents_ExplorerActivate
&
AppEvents_ExplorerSelectionChange

We want to distinguish emails opened on the preview pane from the ones which are opened on their own window via double click.
How can we accomplish that?
Thank you
Posted 15 Jul, 2020 13:34:04 Top
Andrei Smolin


Add-in Express team


Posts: 17288
Joined: 2006-05-11
Hello Sagi,

You need to select en email for the Reading Pane to show it. When, you need to handle ExplorerSelectionChange and get the selected item via Explorer.Selection[1]. See how to do this correctly at https://www.add-in-express.com/creating-addins-blog/2011/12/08/handle-outlook-item-reply-event/.

As to getting the item opened in an inspector window, see https://www.add-in-express.com/forum/read.php?FID=5&TID=13787.

Also, check https://www.add-in-express.com/forum/read.php?FID=5&TID=14072.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jul, 2020 02:15:16 Top
Sagi




Posts: 4
Joined: 2020-07-15
Andrei Smolin writes:
t the selected item via Explore

Thank you Andrei
We already do most of what you've mentioned, however, I'm not sure which part of your reply is what we need simply to determine if the
MailItem
is shown within an inspector window or in reading pane
Posted 16 Jul, 2020 02:26:34 Top
Andrei Smolin


Add-in Express team


Posts: 17288
Joined: 2006-05-11
In what way you get that MailItem?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jul, 2020 02:34:02 Top
Sagi




Posts: 4
Joined: 2020-07-15
ExplorerSelectionChange


using (var selection = ComWrapper.Create(explorer.Selection))
    return selection.Value.Count == 0 ? null : selection.Value[1];
Posted 16 Jul, 2020 02:43:16 Top
Andrei Smolin


Add-in Express team


Posts: 17288
Joined: 2006-05-11
The way used indicates that the item is received from an Explorer object, not from an Inspector one. That is, it was selected.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jul, 2020 03:53:10 Top
Sagi




Posts: 4
Joined: 2020-07-15
Sorry I wasn't clear enough.
We handle both
ExplorerSelectionChange
&
AppEvents_ExplorerActivate
.
In ExplorerSelectionChange it's indeed easy as you've mentioned.
However, when we get an
AppEvents_ExplorerActivate
event, we need to be able to determine if it's coming from the explorer (reading/preview pane) or inspector window
Posted 16 Jul, 2020 05:48:01 Top
Andrei Smolin


Add-in Express team


Posts: 17288
Joined: 2006-05-11
As the name suggests, the ExplorerActivate event is raised when an Explorer gets active. This means, it can't be raised by activating an inspector window.

I may misunderstand your "coming from". What does it mean? Who raises the event? Outlook. What raises the event? Your switching to an Exlporer window. The event name suggests the event cannot relate to inspector or Reading Pane; it relates to activating an Outlook Explorer window.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Jul, 2020 06:18:28 Top