Knowledge Base

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

Article ID: 181035

Article Last Modified on 7/15/2004


APPLIES TO


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
				

Keywords: kbhowto kbmsg KB181035