The information in this article applies to:
SUMMARYThis article provides methods you can use to programmatically determine whether Outlook is online or offline. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspThe Outlook object model does not provide a direct way to determine whether or not Outlook is online or offline. However, there are two common approaches that you can use to accomplish this. Error Trap a Specific Public FolderWhen Outlook is offline, you cannot reference public folders that are available while Outlook in online. If you attempt to do so, Outlook will generate a run-time error. Therefore you can use use error trapping in your code to determine whether or not Outlook is currently online. The key advantage of using this approach is that you do not need to use the Collaborative Data Object (CDO) object model, so you do not need to make sure that CDO is installed on all of the client computers. The disadvantage to using this approach is that it will only work in a Microsoft Exchange Server environment.The following Visual Basic Scripting Edition (VBScript) function can be placed in a custom form. As implemented below, it is designed to run whenever an item is opened.
Use the CDO Object LibraryYou can use CDO to check the value of a MAPI property representing whether or not Outlook is online. The disadvantage to this approach is that you must ensure that the CDO object library is installed on all of the client computers on which this solution will run.For additional information and an example of using CDO to determine the offline status, click the article number below to view the article in the Microsoft Knowledge Base: Q181035 HOWTO: Determine If a CDO Session Is Online or Offline from VBThe following code sample can be used in an Outlook form.
REFERENCESFor additional information about how to obtain CDO, click the article number below to view the article in the Microsoft Knowledge Base: Q171440 INFO: Where to Acquire the Collaboration Data Objects LibrariesFor additional information about creating solutions with Outlook, click the article numbers below to view the articles in the Microsoft Knowledge Base: Q180826 OL98: Resources for Custom Forms and Programming Q182349 OL98: Questions About Custom Forms and Outlook Solutions Additional query words: OutSol OutSol98
Keywords : kbOutlookObj |
Last Reviewed: January 11, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |