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

ID: Q181035


The information in this article applies to:
  • Collaboration Data Objects (CDO), versions 1.0a, 1.1, 1.2, 1.21
  • 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 : kbCDO100a kbCDO110 kbCDO120 kbCDO121 kbMsg kbVBp400 kbVBp500 kbGrpMsg
Version : WINDOWS:1.0a,1.1,1.2,1.21,4.0,5.0
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: November 5, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.