Muokkaa

Jaa


NameSpace.ExchangeConnectionMode property (Outlook)

Returns an OlExchangeConnectionMode constant that indicates the connection mode of the user's primary Exchange account. 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 returns True. If the ExchangeConnectionMode property is olOnline, olConnected, or olConnectedHeaders, the NameSpace.Offline property returns 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 the download state is 'Header Only' in the Inbox folder.

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

NameSpace Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.