Microsoft KB Archive/181035

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:31, 21 July 2020 by X010 (talk | contribs) (Text replacement - "&" to "&")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

  • Microsoft Collaboration Data Objects 1.21
  • Microsoft Collaboration Data Objects 1.0a
  • Microsoft Collaboration Data Objects 1.1
  • Microsoft Collaboration Data Objects 1.2
  • Microsoft Visual Basic 4.0 Standard Edition
  • Microsoft Visual Basic 4.0 Enterprise Edition



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