Share via


NameSpace.ExchangeConnectionMode Property

Outlook Developer Reference

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

Syntax

expression.ExchangeConnectionMode

expression   A variable that represents a NameSpace object.

Remarks

If the ExchangeConnectionMode property is olOffline or olDisconnected, the NameSpace.Offline property will return True . If the ExchangeConnectionMode property is olOnline, olConnected, or olConnectedHeaders, 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.

Visual Basic for Applications
  Sub MarkHighImportance()
    Dim myNamespace As Outlook.NameSpace
    Dim mpfInbox As Outlook.Folder
    Dim obj As Object
    Dim ctr As Integer
    Dim i As Integer
Set myNamespace = Application.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

See Also