Search code examples
c#outlookoutlook-addinoffice-addinsemail-attachments

Outlook Explorer Object Giving 'NULL' Attachment Selection


I want a selected attachments from below window.

I have used Explorer.AttachmentSelection method. But its not giving me any selection.

How to achieve it?

enter image description here


Solution

  • The AttachmentSelection object contains a read-only collection of attachments that are selected in an item that is in the active inspector or the active explorer. Use the ActiveExplorer method of the Application class which returns the topmost Explorer object on the desktop. An Explorer that represents the topmost explorer on the desktop is returned. You may get Nothing or Null if no explorer is active. So, you may get null if no attachments is selected in the view.

    I'd suggest click on any attachment in the view and validate how the code is working. You should get the attachment instance selected in the Outlook view.