And here is how to directly get the exchange user without looping.
Replace USER NAME with your desired search name.
vb Code:
Option Explicit On Option Strict On Imports Microsoft.Office.Interop Imports Microsoft.Office.Interop.Outlook.OlAddressEntryUserType 'Add reference to MS Outlook xx.x Object Library Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oApp As Outlook.Application Dim eu As Outlook.ExchangeUser oApp = DirectCast(CreateObject("Outlook.Application"), Outlook.Application) eu = oApp.GetNamespace("MAPI").AddressLists("Global Address List").AddressEntries("USER NAME").GetExchangeUser() If Not eu Is Nothing Then Console.WriteLine(eu.Name + ": " + eu.Alias + ", " + eu.FirstName + ", " + eu.LastName + ", " + eu.MobileTelephoneNumber + ", " + eu.Department + ", " + eu.PrimarySmtpAddress) End If eu = Nothing oApp.Quit() oApp = Nothing End Sub End Class





Reply With Quote