vba如何访问微软服务器网址,AddressEntry.GetExchangeUser 方法 (Outlook)

AddressEntry.GetExchangeUser 方法 (Outlook)

06/08/2017

本文内容

返回一个 AddressEntry 属于 Exchange

语法

expression。 GetExchangeUser

返回值

代表 AddressEntry ExchangeUser 对象。 如果 AddressEntry (对象 不对应于Visual Basic) ,则返回 Null 或 Nothing Exchange Nothing。

备注

您必须连接到 Exchange 服务器才能使用此方法。

如果使用此方法传递一个字符串字符集,则类似于现有的地址条目,则返回值可能包括根据传递的字符串的第一个字母相匹配的条目。

例如,您传递字符串"插座"Exchange 用户都具有一个地址条目"Jai"在他的 Outlook 通讯簿,但不是"插座"。 尽管"插座"条目不是 Outlook 通讯簿中,则返回电子邮件地址是"Jai"而不是"空"。

示例

下面的代码示例演示如何获取商务电话号码、 办公地点以及 Exchange 全球通讯簿中的所有 Exchange 用户条目的职务。 它首先使用 设置 在每个 AddressEntry ,它使用 AddressEntryUserType 来验证 AddressEntry 是否表示 Exchange 用户。 它找到的 Exchange 用户后,它使用 GetExchangeUser 来获取和输出的用户数据的多个功能。

Sub DemoAE()

Dim colAL As Outlook.AddressLists

Dim oAL As Outlook.AddressList

Dim colAE As Outlook.AddressEntries

Dim oAE As Outlook.AddressEntry

Dim oExUser As Outlook.ExchangeUser

Set colAL = Application.Session.AddressLists

For Each oAL In colAL

'Address list is an Exchange Global Address List

If oAL.AddressListType = olExchangeGlobalAddressList Then

Set colAE = oAL.AddressEntries

For Each oAE In colAE

If oAE.AddressEntryUserType = olExchangeUserAddressEntry _

Or oAE.AddressEntryUserType = olExchangeRemoteUserAddressEntry Then

Set oExUser = oAE.GetExchangeUser

Debug.Print (oExUser.JobTitle)

Debug.Print (oExUser.OfficeLocation)

Debug.Print (oExUser.BusinessTelephoneNumber)

End If

Next

End If

Next

End Sub

另请参阅

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值