繁体   English   中英

Outlook 通讯簿搜索(无循环?)

[英]Outlook Address Book Search (No Looping?)

无论如何,是否可以在没有任何 For 循环的情况下使用联系人的电子邮件地址在 Outlook 地址框中搜索联系人? 我们的全球联系人列表中有很多联系人,浏览列表需要很长时间。 是否有可以应用于联系人列表的搜索或查找功能。

如果在联系人列表中找到用户的电话号码和办公室,我希望获得这些信息。

我发现的所有解决方案都涉及循环访问联系人列表。 http://www.ozgrid.com/forum/showthread.php?t=76588

https://msdn.microsoft.com/en-us/library/office/ff869721.aspx

使用Namespace.CreateRecipient / Recipient.Resolve解析地址簿中的名称(或地址)。 即使您传递了 SMTP 地址,它也会被解析为 GAL 用户(如果存在匹配)。

这是我用来使用全局地址簿中的电子邮件地址获取联系人电话号码的解决方案 - 使用 Dmitry Streblechenko 方法。

Sub GetPhone(EmailAddress As String) 'Gets the phone # for contact
Dim OutApp As Outlook.Application
Dim OutMail As Object
Dim OutRecipients As Outlook.Recipient
Dim PhoNe As String


On Error Resume Next
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

Set OutRecipients = OutMail.Recipients.Add(EmailAddress)
OutRecipients.Resolve

PhoNe = OutRecipients.AddressEntry.GetExchangeUser.BusinessTelephoneNumber
Set OutRecipients = Nothing
Set OutMail = Nothing
Set OutApp = Nothing
On Error GoTo 0
End Sub

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM