title: Check exchange connectivity status
body: <p>I want to check if the exchange server configured with the Outlook account is available before proceeding with my script. Currently, I don't check and if there's a connectivity issue the script will hang forever on this line</p>
  
  <pre><code>Set m_objNS = m_objOutlook.GetNamespace("MAPI")
  </code></pre>
  
  <p>and appear unresponsive.</p>
  
  <p>If there's no way to do that from within the Outlook API, is there a way I could retrieve the exchange server address and ping it or set a 20 second timeout on the .GetNameSpace function?</p>
  
  <p>Update: If there's a problem with the network adapter (like if it's disabled), the code can access the namespace object. The exchange mode will always be 400 until there's a prompt to authorise the code and the user accepts it. However, if there's a real (non-test purpose issue) like the exchange server is down (destination host unreachable), Outlook idle in the state "trying to connect" and you can't access .Session object or the MAPI. </p>
  
  <p>There must be a way to tell if the server is down.</p>