ExchangeConnectionMode 属性 (Outlook)NameSpace.ExchangeConnectionMode property (Outlook)

返回一个**OlExchangeConnectionMode** 常量, 该常量指示用户的主 Exchange 帐户的连接模式。Returns an OlExchangeConnectionMode constant that indicates the connection mode of the user's primary Exchange account. 此为只读属性。Read-only.


expressionexpression. ExchangeConnectionMode

_表达式_一个代表 "NameSpace" 对象的变量。expression A variable that represents a 'NameSpace' object.


如果ExchangeConnectionMode属性为olOfflineolDisconnected, 则**NameSpace** 属性返回TrueIf the ExchangeConnectionMode property is olOffline or olDisconnected, the NameSpace.Offline property returns True. 如果 ExchangeConnectionMode 属性为 olOnlineolConnectedolConnectedHeadersNameSpace.Offline 属性返回 FalseIf the ExchangeConnectionMode property is olOnline, olConnected, or olConnectedHeaders, the NameSpace.Offline property returns False.


下面的 Microsoft Visual Basic for Applications (VBA) 示例将在连接模式为 "已连接的邮件头" 且下载状态为 "收件箱" 文件夹中的 "仅标头" 时, 将发送高重要性的邮件标记为 "已发送邮件"。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 
 End If 
End Sub

另请参阅See also

命名空间对象NameSpace Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.