【问题标题】:Search through Global Address List搜索全局地址列表
【发布时间】:2012-01-10 08:19:47
【问题描述】:

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

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,只有 Justin Bieber 会是结果,因为它是列表中的第一个。

【问题讨论】:

    标签: asp.net vb.net office-interop outlook-2010


    【解决方案1】:

    您需要在 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-11
      • 1970-01-01
      • 1970-01-01
      • 2019-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多