How To Determine If a CDO (1.x) Session Is Online or Offline from VB (181035)



The information in this article applies to:

  • Collaboration Data Objects (CDO) 1.21
  • Collaboration Data Objects (CDO) 1.0a
  • Collaboration Data Objects (CDO) 1.1
  • Collaboration Data Objects (CDO) 1.2
  • Microsoft Visual Basic Standard Edition for Windows 4.0
  • Microsoft Visual Basic Enterprise Edition for Windows 4.0

This article was previously published under Q181035

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 (1.x), the PR_STORE_OFFLINE property is exposed as a member of the Fields collection of an InfoStore object.

MORE INFORMATION

The following Visual Basic code sample demonstrates how to access the PR_STORE_OFFLINE property of an InfoStore object using the CDO (1.x) Library. This code assumes a valid reference to the Collaboration Data Objects (1.x) Library.
   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
				

Modification Type:MinorLast Reviewed:7/15/2004
Keywords:kbhowto kbMsg KB181035