L
L
lemial2015-02-03 09:23:05
C++ / C#
lemial, 2015-02-03 09:23:05

How to check if a mail account exists?

Greetings!
Please tell me how to check if a configured mail account exists on a windows system before starting Outlook using C#. Those. if mail is configured, we start Outlook, if not, we don't start it.
Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Filandor, 2015-02-03
@LifeAct

try to log in ...
it worked - we start it, it didn't work - it's not configured correctly

V
Valery Okhotnikov, 2015-02-03
@vox13

1) We check the presence of configured mail accounts in Outlook
2) It would be nice to check not only their presence, but also their performance (log in), as Dmitry wrote above.
Example (getting information about mail accounts):
https://msdn.microsoft.com/EN-US/library/office/ff...

L
lemial, 2015-02-10
@lemial

Stupid somewhere, help again plz:

try
        {
            Outlook.Application oAccounts = new Outlook.Application();
            Outlook.Accounts oCheckAcc = oAccounts.Session.Accounts;

            foreach (Outlook.Account account in oCheckAcc)
            {
                if (account.DisplayName.ToString().Contains("@"))
                {
                          // blablabla
                }
                break;
            }
       }

If the account is not registered, the wizard starts, how to avoid this, i.e. just observe the silence mode if there are no registered accounts?
Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question