none
How to check if Preview Pane is (really) empty? RRS feed

  • Question

  • Hi everyone,

    I develop a VSTO plugin that performs some operations on the MailItems that are selected in Explorer via SelectionChange event.

    In Outlook, users can switch off 'Always preview messages' setting. I don't want to process a mail if this setting is disabled.

    During initial launch of the Outlook, Explorer.SelectionChange event is fired, but the Preview Pane does not contain the item (it shows a text message 'Select an item to read'), which is expected, if the setting is turned off.

    I want to skip this event in case Preview Pane is empty.

    I tried to use

    _explorer.IsPaneVisible(OlPane.olPreview);

    but it returns always true regardless if MailItem is displayed in the Preview Pane or no.

    Is there any way to check if the selected MailItem (obtained via Explorer.Selection) is really displayed in the Preview Pane?

    Thanks in advance.


    • Edited by Qobalt2020 Friday, March 27, 2020 5:27 PM
    Friday, March 27, 2020 5:27 PM

All replies

  • Check if _explorer.PreviewPane.WordEditor == null

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, March 27, 2020 5:46 PM
  • @Dmitry - I am using Microsoft.Office.Interop.Outlook.Explorer, and there is no PreviewPane property.

    EDIT: It exists since Outlook 2016 but I need to support older versions as well.

    I can not use Redemption btw.



    • Edited by Qobalt2020 Friday, March 27, 2020 6:15 PM
    Friday, March 27, 2020 6:02 PM
  • If you need to support Outlook 2013 or older and cannot use Redemption, there isn't much you can do...

    But you can access that property dynamically under Outlook 2016 even you are using an older interop


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, March 27, 2020 7:16 PM