none
Programmatically access the list of "From" address RRS feed

  • Question

  • Hi

    In Outlook (2010/13/16) when the user open a new mail, I'm trying to figure how I :

    - Can access the list of email available in the "from" address

    - Detect if a specific address is present in the list

    - Update the "From" to set this specific address

    I already know how to run the code when the mail is created / opened etc., I'm currently blocked on how to handle these points. I'm using a COM add-in for this.

    Do you think it's something that's possible to do ?

    Thank you for your help


    • Edited by Fabrice Durieu Thursday, September 1, 2016 8:21 AM added add-in type (COM)
    Thursday, September 1, 2016 8:21 AM

Answers

  • You should be able to do that using Redemption and ProfMan (or Extended MAPI) -

    1. For each account, read the PROP_ACCT_PREFERENCES_UID property. You can see it in OutlookSpy:  click IOlkAccountManager button, double click on the Exchange account you are after.

    2. Right click on the PROP_ACCT_PREFERENCES_UID property, select IMAPISession::OpenProfileSection.

    3. Select the 0x0483101F property - it is a multivalued property (PT_MV_UNICODE). Each entry is a string with 0xD separating the SMTP address and display name.


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

    • Proposed as answer by David_JunFeng Tuesday, September 13, 2016 2:30 PM
    • Marked as answer by David_JunFeng Thursday, September 15, 2016 2:29 PM
    Monday, September 5, 2016 8:51 PM

All replies

  • If you want to send as another Exchange user, set the SentOnBehalfOfName property.

    If you want to send using a POP3/SMTP account already configured in Outlook, set the MailItem.Account property.


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

    Thursday, September 1, 2016 3:22 PM
  • The SentOnBehalfOfName is exactly what I need to set the value, thank you.

    But how can I retrieve the list of available from ?

    I want to know it the user added a specific address to his list of from, which is not an account

    Thanks 

    Thursday, September 1, 2016 10:45 PM
  • Available in what sense? The list of accounts (Namespace.Accounts)? Or then names that the user previously manually specified by clicking the From button?  

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

    Thursday, September 1, 2016 10:55 PM
  •  names that the user previously manually specified by clicking the From button?  

    This one.

    What happen is that my add-in give him access to emails that he didn't receive (it was received by a sort of group box)

    And when replying, it's going out with his own email in the FROM. This is accepted as a default behavior.

    But I want to that if he add the group email in the From list, this is automatically selected when he reply. Otherwise he'll have to do it manually each time, and then of course will forgot a few time.


    Friday, September 2, 2016 8:26 AM
  • Hi Fabrice Durieu,

    According to your description, could you provide screenshot, that will help us understand clearly your requirement, then resolve this issue.

    Thanks for your understanding.
    Friday, September 2, 2016 9:40 AM
  • That list is stored in each account's profile section. It is only accessible using Extended MAPI (C++ or Delphi).

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

    Friday, September 2, 2016 1:40 PM
  • Hi Fabrice Durieu,

    According to your description, could you provide screenshot, that will help us understand clearly your requirement, then resolve this issue.

    Thanks for your understanding.

    In green you have all accounts added in Outlook. I know how to retrieve this list via Namespace.Accounts

    In yellow you have the "From" manually added. I try to retrieve this list.

    Thank you

    Saturday, September 3, 2016 9:52 AM
  • That list is stored in each account's profile section. It is only accessible using Extended MAPI (C++ or Delphi).

    I already bought Outlook Redemption licence, so is it possible with your library ?

    I've redemption v5.2

    Thank you

    Saturday, September 3, 2016 9:54 AM
  • >>>I already bought Outlook Redemption licence, so is it possible with your library ?

    According to your description, since this is the forum to discuss questions and feedback for Outlook for Developers and Outlook Redemption is third-party library, I suggest that you could post your Redemption related questions in the Outlook-Redemption mailing list.

    Thanks for your understanding.
    Monday, September 5, 2016 8:08 AM
  • >>>I already bought Outlook Redemption licence, so is it possible with your library ?

    According to your description, since this is the forum to discuss questions and feedback for Outlook for Developers and Outlook Redemption is third-party library, I suggest that you could post your Redemption related questions in the Outlook-Redemption mailing list.

    Thanks for your understanding.

    No, sorry, I don't understand.
    You asked for a screenshot, I gave you with the screenshot. Then instead of replying to my question you prefer to drop it to third party. I search a way to do it with the OOM, before trying with 3rd party if OOM can't do it.

    So, could you tell me if it's possible to do it with OOM ?

    Thank you

    Monday, September 5, 2016 3:35 PM
  • You should be able to do that using Redemption and ProfMan (or Extended MAPI) -

    1. For each account, read the PROP_ACCT_PREFERENCES_UID property. You can see it in OutlookSpy:  click IOlkAccountManager button, double click on the Exchange account you are after.

    2. Right click on the PROP_ACCT_PREFERENCES_UID property, select IMAPISession::OpenProfileSection.

    3. Select the 0x0483101F property - it is a multivalued property (PT_MV_UNICODE). Each entry is a string with 0xD separating the SMTP address and display name.


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

    • Proposed as answer by David_JunFeng Tuesday, September 13, 2016 2:30 PM
    • Marked as answer by David_JunFeng Thursday, September 15, 2016 2:29 PM
    Monday, September 5, 2016 8:51 PM
  • >>>So, could you tell me if it's possible to do it with OOM ?

    As far as I know that it is impossible to do it with OOM.

    Thanks for your understanding.
    Tuesday, September 6, 2016 9:56 AM
  • Hi Fabrice,

    Were you able to update the "From" to set of specific address? If so, did you use extended MAPI for it? I am using extended mapi and followed the steps Dmitry mentioned to access the list. I am able to add a new one and it is seen in the outlook spy. But newly added one is not seen in the From drop down. Please let me know if you faced the same.

    Thanks in adavance.

    Wednesday, September 6, 2017 6:24 AM
  • Hi Fabrice,

    Were you able to update the "From" to set of specific address? If so, did you use extended MAPI for it? I am using extended mapi and followed the steps Dmitry mentioned to access the list. I am able to add a new one and it is seen in the outlook spy. But newly added one is not seen in the From drop down. Please let me know if you faced the same.

    Thanks in adavance.

    Hi,

    No, sorry, I didn't succeed. In fact, Dmitry's answer show my that it was too much difficult for the benefit, and I was short in time.

    I finally just update the "SentOnBehalfOfName" property and it works: it doesn't add the email in the From list, but it show it in From and send the email under this name (which was my main objective)

    Please also note that I got some report that for some users it doesn't work, still didn't had the time to investigate why. 

    Friday, September 8, 2017 4:38 PM
  • Got to know that 0x0484 needs to be updated as well for from drop down to list the email addresses added programatically. But unable to find a pattern to update that. Not able to make out if its first valid index or last updated index.
    Wednesday, September 13, 2017 11:04 AM
  • Set its value to 0 - it is the index of the first "good" entry.

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

    Wednesday, September 13, 2017 3:18 PM