ExchangeConnectionMode Property

Microsoft Outlook Visual Basic

Show All Show All

ExchangeConnectionMode Property

Returns an OlExchangeConnectionMode constant that indicates the current connection mode the user is using. Read-only.

OlExchangeConnectionMode can be one of the following constants:
  • olOffline(100)
  • olOnline (500)
  • olDisconnected (200)
  • olConnectedHeaders (300)
  • olConnected (400)
  • olNoExchange (0)

expression.ExchangeConnectionMode

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

The Namespace.Offline property will also return True if the connection mode is offline. However, if the connection mode is low bandwidth or online, the Namespace.Offline property will return False.

Example

The following Microsoft Visual Basic for Applications (VBA) example marks the items that are sent with high importance for download if the connection mode is 'Connected Headers' and download state is 'Header Only' in the Inbox folder.

    Sub MarkHighImportance()
 Dim myOlApp As New Outlook.Application
 Dim myNamespace As Outlook.NameSpace
 Dim mpfInbox As Outlook.MAPIFolder
 Dim obj As Object
 Dim ctr As Integer
 Dim i As Integer
 Set myNamespace = myOlApp.GetNamespace("MAPI")
 Set mpfInbox = myNamespace.GetDefaultFolder(olFolderInbox)
 ctr = mpfInbox.Items.count
 If (myNamespace.ExchangeConnectionMode = olConnectedHeaders) Then
  For i = 1 To ctr
   Set obj = mpfInbox.Items.Item(i)
   If (obj.Importance <> olImportanceHigh And obj.DownloadState = olHeaderOnly) Then
    obj.MarkForDownload = olMarkedForDownload
   End If
  Next
 End If
End Sub