I would like to find the sender's folder RRS feed

  • Question

  • I would like to use the sender's folder at the ItemSend event.

    In the following cases, always select the primary user's folder.

    Dim myNamespace As [NameSpace] = Application.GetNamespace("MAPI")
    Dim myFolder As Folder = myNamespace.GetDefaultFolder(OlDefaultFolders.olFolderOutbox)

    When using ActiveExplorer(), unintended folders may be selected depending on the state of ActiveExplorer().

    Dim store As Outlook.Store = Globals.ThisAddIn.Application.ActiveExplorer().CurrentFolder.Store
    Dim myFolder As Outlook.Folder = store.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)

    How can I find the sender's folder?

    Tuesday, January 31, 2017 10:10 AM


  • Hello,

    If user specified another account (not default) for sending from, the SendUsingAccount property can be used for getting an Account object that represents the account under which the MailItem is to be sent. The DeliveryStore property of the Account class returns a Store object that represents the default delivery store for the account. So, you can use the GetDafaultFolder method of the Store class which returns a Folder object that represents the default folder in the store and that is of the type specified by the FolderType argument.

    If the SendUsingAccount property returns null, the default account was used. You can use the existing code base, i.e. the GetDefaultFolder method of the Namespace class.

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Marked as answer by giro011 Wednesday, February 1, 2017 2:44 AM
    Tuesday, January 31, 2017 12:11 PM