Home > Mobile >  Outlook Add-in Development : Require Previous Selection Object Of Mailbox
Outlook Add-in Development : Require Previous Selection Object Of Mailbox

Time:01-02

I have a Explorer.SelectionChange event.

Here is a image of outlook inbox : https://i.stack.imgur.com/ynQXO.png

I want a previous selection of mail in Explorer.SelectionChange event. eg :

  • Select 'Mail 1'
  • Now on selection of 'Mail 2', I want a 'Mail 1'

CodePudding user response:

The Outlook object model doesn't provide anything for that out of the box. You need to get the EntryID property value of the selected item (for example, in the SelectionChange event or at any point of time by using the Selection property) and keep it until another item is selected, so you could have it when needed. But don't keep the MailItem instance in the code, that is not really a good idea. You should release underlying COM objects in the code instantly and don't hold them where possible. The original item instance can be retrieved when required by using the GetItemFromID method which returns a Microsoft Outlook item identified by the specified entry ID (if valid).

  • Related