HOWTO: Determine If a CDO Session Is Online or Offline from VB

Last reviewed: February 16, 1998
Article ID: Q181035
The information in this article applies to:
  • Collaboration Data Objects (CDO), versions 1.0a, 1.1, 1.2
  • Microsoft Visual Basic Standard and Enterprise Editions for Windows, versions 4.0, 5.0

SUMMARY

When an application logs on to Exchange Server using a profile that includes an offline store (OST), it may be necessary to determine the online/offline status of the store programmatically. This information is found in a MAPI property (PR_STORE_OFFLINE) that is set on the Message Store object. The PR_STORE_OFFLINE property is a Boolean property that is True if the store is offline and False if the store is online.

From CDO, the PR_STORE_OFFLINE property is exposed as a member of the Fields collection of an InfoStore object.

MORE INFORMATION

Here is a Visual Basic code sample demonstrating how to access the PR_STORE_OFFLINE property of an InfoStore object using the CDO Library. This code assumes a valid reference to the Microsoft Active Messaging 1.1 Object Model (now named Collaboration Data Objects) or later.

   Private Sub Command1_Click()
      Dim objSession As MAPI.Session
      Dim objInfoStore As InfoStore
      Set objSession = CreateObject("mapi.session")
      objSession.Logon
      Set objInfoStore = objSession.InfoStores("Public Folders")
      If objInfoStore.Fields(&H6632000B).Value Then  'PR_STORE_OFFLINE
          MsgBox "Store is offline", , "Offline Status"
      Else
          MsgBox "Store is online", , "Offline Status"
      End If
   End Sub


Additional query words: ActMsg OleMsg
Keywords : cdo
Version : WINDOWS:1.0a,1.1,1.2,4.0,5.0
Platform : WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 16, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.