'Outlook email address instead of DisplayName

I have a python code for Outlook. I have multiple accounts and with the code I would like to read Inbox emails from a specific account. The account (email address) will be an input parameter.

    outlook = win32com.client.Dispatch('outlook.application')
    mapi = outlook.GetNamespace("MAPI")
    for store in mapi.Session.Stores:
        print(store.DisplayName)

Based on the display name I could tell that it is the correct account or not. Right now the comparison is not working as the DisplayName is like "Test | Company" instead of "[email protected]".

Could you please help how to change the displayed account name?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source