none
How to get the provider name using outlook APIs RRS feed

  • Question

  • Hi,

               I am developing a outlook add-in. Our mailbox is gmail, but we configured outlook as a client for sending and receiving emails. Is there any way that i can find my service provider is "Gmail" (what ever may be). Based on service provider we have specific requirements to be met.

    Tuesday, June 23, 2015 9:35 AM

Answers

  • Hi sivlai,

    Thanks for your response.

    I need to get the provider is Gmail.

    Similarly if the account is Hotmail i need to get the provider like Hotmail.

    Is there any way to get like this?

    There is no such provider like Gmail, Hotmail as you described. It seems that you want to detect which server provide the mail service for the account in Outlook.

    If I understood correctly, there is no such API in Outlook object model. However, we can get the accounts in Outlook use Accounts Object, then we can get email address via DispalyName property.

    At last we can analyze the "provider" from the email address. For example, we can get the substring 'Gmail' from xxxx@gmail.com start from '@' and end with'.'.

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 29, 2015 8:01 AM
    Moderator

All replies

  • Hello sivlai,

    Most probably the Gmail account configured using the Imap protocol.

    The Account class provides the AccountType property which returns a constant in the OlAccountType enumeration that indicates the type of the Account.

    olEas

    4

    An account that uses Exchange ActiveSync (EAS) on mobile devices.

    olExchange

    0

    An Exchange account.

    olHttp

    3

    An HTTP account.

    olImap

    1

    An IMAP account.

    olOtherAccount

    5

    Other or unknown account.

    olPop3

    2

    A POP3 account.

    Also you may find the SmtpAddress property of the Account class which returns a string representing the Simple Mail Transfer Protocol (SMTP) address for the Account.

    Tuesday, June 23, 2015 12:01 PM
  • Read the PR_MDB_PROVIDER MAPI property (DALS name http://schemas.microsoft.com/mapi/proptag/0x34140102) using PropertyAccessor.GetProperty from any object in that store.
    For the Google Apps store provider, it will be MSPST_UID_PROVIDER (4E495441F9BFB80100AA0037D96E0000) since it is based on the wrapped PST store provider). Not much help.

    In Extended MAPI (C++ or Delphi), you can read the 0x20000102 property from the corresponding IOlkAccount MAPI object and use it ot call IMAPISession.OpenProfileSection. You can then read PR_SERVICE_NAME property from the returned IProfSect object. It will be "GSync" for the Google Apps store.


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

    Tuesday, June 23, 2015 4:28 PM
  • Thanks for your quick response.

    Through this i can get IMAP, but not the actual provider.

    Wednesday, June 24, 2015 10:41 AM
  • sivlai,

    What do you mean by "actual provider".

    For example, Outlook could be configured with an account to access GMail and a different account in the same profile that accessed any other ISP's POP3 email server.  In that situation, who do you consider to be the "actual provider"?

    Wednesday, June 24, 2015 10:53 AM
  • Thanks for your response. I tried to read PR_MDB_PROVIDER, but it is showing different value.

    Binary: E92FEB759650448683B87DE522AA4948

    Similarly PR_SERVICE_NAME  is showing differently. 

    Unicode: INTERSTOR

    Binary: 49004E00540045005200530054004F005200

    please help me to resolve this issue.

    Wednesday, June 24, 2015 10:57 AM
  • INTERSTOR is the IMAP4 provider.

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

    Wednesday, June 24, 2015 2:32 PM
  • Thanks for your response.

    I need to get the provider is Gmail.

    Similarly if the account is Hotmail i need to get the provider like Hotmail.

    Is there any way to get like this?

    Friday, June 26, 2015 5:36 AM
  • Hi sivlai,

    Thanks for your response.

    I need to get the provider is Gmail.

    Similarly if the account is Hotmail i need to get the provider like Hotmail.

    Is there any way to get like this?

    There is no such provider like Gmail, Hotmail as you described. It seems that you want to detect which server provide the mail service for the account in Outlook.

    If I understood correctly, there is no such API in Outlook object model. However, we can get the accounts in Outlook use Accounts Object, then we can get email address via DispalyName property.

    At last we can analyze the "provider" from the email address. For example, we can get the substring 'Gmail' from xxxx@gmail.com start from '@' and end with'.'.

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 29, 2015 8:01 AM
    Moderator