Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

MW-Menu

 

Free Visual BASIC Newsletter

Features

Tips

Sample Code

Newsletters

Products

ActiveX

Cool Links

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Resolve an Email Address with the MAPI Directly

 

Why bother using the bulky ActiveX control or the Outlook OLE interface, when you can use can use the MAPI directly. Here is the sample

Option Explicit

Private Type MapiRecip

Reserved As Long

RecipClass As Long

Name As String

Address As String

EIDSize As Long

EntryID As String

End Type

Private Declare Function MAPIResolveName Lib "MAPI32.DLL" Alias

"BMAPIResolveName" (ByVal Session As Long, ByVal UIParam As Long, ByVal

UserName As String, ByVal Flags As Long, ByVal Reserved As Long, Recipient

As MapiRecip) As Long

Public Function Resolve(sName As String)

Dim tRecip As MapiRecip

Dim lTemp As Long

lTemp = MAPIResolveName(0&, 0&, sName, &H1, 0&, tRecip)

If lTemp <> 0 Then Resolve = 0: Exit Function

With tRecip

Resolve = .Address

End With

End Function

Call the function like the following:

<Variable> = Resolve("<Full Name>")

If the user exists then the email address will be returned. If the user

cannot be found then 0 is returned.

Home

___________________________________________

Send Bugs, comments to the webmaster at webmaster@mwe.8m.com

Terms of Use

© 1999 MW Software, all rights reserved