detect connection status in outlook

Add-in Express™ Support Service
That's what is more important than anything else

detect connection status in outlook
updating question from old topic 
aweber




Posts: 72
Joined: 2013-11-21
I have looked at this thread https://www.add-in-express.com/forum/read.php?FID=5&TID=6794

I'm wondering if anything new has been made available in Outlook from 2010 onwards (and with latest versions of ADX)? Specifically, I notice OL2010 has a "Connected to Microsoft Exchange" indicator in the bottom of the application/explorer window. This changes pretty quickly if my connection to the Exchange Server is lost (to various icons and labels like "Trying to connect").

How can we detect this ourselves?

Thanks.
Posted 27 Feb, 2018 11:35:28 Top
Andrei Smolin


Add-in Express team


Posts: 15357
Joined: 2006-05-11
Hello AJ,

Outlook 2010 introduced Account.ExchangeConnectionMode and NameSpace.ExchangeConnectionMode. OOM provides no event related to connection being lost or restored.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Feb, 2018 07:41:37 Top
aweber




Posts: 72
Joined: 2013-11-21
Thanks, Andrei.

But those appear to just be properties. How would we wait on them so we know when the property changes? We need something like an ExchangeConnectionModeCHANGED event.
Posted 28 Feb, 2018 08:37:57 Top
Andrei Smolin


Add-in Express team


Posts: 15357
Joined: 2006-05-11
That's the point: the Outlook object model doesn't provide such an event.

aweber writes:
OL2010 has a "Connected to Microsoft Exchange" indicator


If you badly need that event, you can use Active Accessibility or UI automation to check that indicator periodically.

Also, you can ask your question on the Outlook for Developers forum at https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev. If you do this, may I ask you to post here a link to your question?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Feb, 2018 09:09:36 Top
Emmanuel SELLIER




Posts: 20
Joined: 2016-11-23
If you just need to check the Internet connection (not the connection to the mail server), then try this:

 public class InternetConnection
        {
            [DllImport("wininet.dll")]
            private extern static bool InternetGetConnectedState(out int Description, int ReservedValue);

            public static bool IsConnectedToInternet()
            {
                bool returnValue = false;
                try
                {
                    int Desc;
                    returnValue = InternetGetConnectedState(out Desc, 0);
                }
                catch
                {
                    returnValue = false;
                }
                return returnValue;
            }
        }
Posted 06 Apr, 2018 11:11:22 Top
Andrei Smolin


Add-in Express team


Posts: 15357
Joined: 2006-05-11
Thank you!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Apr, 2018 05:13:19 Top