次の方法で共有


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

Concepts

NameSpace Object

NameSpace Object Members