搜索全局地址列表

发布于 2024-12-18 16:36:49 字数 797 浏览 3 评论 0原文

有没有办法只搜索 GAL 中联系人的给定姓名或姓氏或电子邮件地址?目前我有这些代码:

Private Sub QuickSearch() 'Working!
    Dim oApp As New Outlook.Application
    Dim eu As Outlook.ExchangeUser = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("Justin Timberlake").GetExchangeUser()
    If Not eu Is Nothing Then
        response.write(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress)
    End If
    oApp.Quit()
End Sub

嗯,这个代码的工作原理类似于通过 AddressList GAL 进行快速搜索。但出现的一个问题是,例如我有以下联系人姓名:

- Justin Bieber

- Justin Timberlake

我搜索了 Justin,仅 >贾斯汀·比伯将是结果,因为它是列表中第一个出现的人。

Is there a way to search for only givenName or LastName or emailaddress of a Contact in GAL?. Currently I have these code:

Private Sub QuickSearch() 'Working!
    Dim oApp As New Outlook.Application
    Dim eu As Outlook.ExchangeUser = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("Justin Timberlake").GetExchangeUser()
    If Not eu Is Nothing Then
        response.write(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress)
    End If
    oApp.Quit()
End Sub

Well, this one works like a Quick Search through the AddressList GAL. but one problem arises is that for example I have these contact names:

- Justin Bieber

- Justin Timberlake

And I searched for Justin, only Justin Bieber will be the result as it is the first one to be seen on the list.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

第几種人 2024-12-25 16:36:49

您需要在 AddressEntries 处停止,然后遍历列表

    Dim oApp As New Outlook.Application
    Dim aeList As Outlook.AddressEntries = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("Justin Timberlake")
    If Not aeList Is Nothing Then
        For Each ae As Outlook.AddressEntry aeList
            Dim eu As Outlook.ExchangeUser = ae.GetExchangeUser()
            response.write(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress)
        Next
    End If

You need to stop at AddressEntries and then iterate through the list

    Dim oApp As New Outlook.Application
    Dim aeList As Outlook.AddressEntries = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("Justin Timberlake")
    If Not aeList Is Nothing Then
        For Each ae As Outlook.AddressEntry aeList
            Dim eu As Outlook.ExchangeUser = ae.GetExchangeUser()
            response.write(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress)
        Next
    End If
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文