Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAPI.ResolveName

Status
Not open for further replies.

griffitd

Programmer
Aug 20, 2002
189
GB
Hi

I have an app that sends an email. I have an issue with the ResolveName command

If there are two contacts, one of which is substring of another: for example, "gordan" and "gordan.smith" and function ResolveName() is called then the email is not sent as it cant resolve the name.

Is there a way round this

Thanks

 
Have you tried setting

MAPIMessages.AddressResolveUI = True

before attempting ResolveName?
 
It's been a lloooong time since I bothered with Simple MAPI, and particularly the somewhat braindead version implemented in the MAPi controls. It's just too limiting ...

So, when you say it still doesn't work, do you mean you don't get the dialog popping up to allow you to distinguish between the ambiguous names?
 
i have two instances:
1. is when it populates the recipients, the email doesnt get sent as it cant resolve the names.

2. when we populate a list a popup is displayed will all instances of gordan

!
Thanks
 
Ok, number 1 is the starting point. So you are saying that even with AddressResolveUI set to True you do not get a pop up when attempting to resolve the recipient names? So what error is being returned?
 
I dont get any erros with either senario.

The email just doesnt get sent.

I only know that the resolvename doesnt work as i edit the code as it builds up the recipent list. When I do this i get an outlook popup with the recipent names (3 in list)

Thanks
 
If ResolveName does anything apart from succeed it should generate a trappable error. However, since (Simple) MAPI itself does not actually do the resolving (leaving that up to the relevant address book provider) the issue may lie elsewhere ...


I think we need to know more. What is your underlying MAPI service? Are you creating a new MAPI session, or piggybacking an existing one?
 
Oh - just dotting i's and crossing t's here: you are certain that you haven't got an error handler in place, e.g. something like On Error Resume Next, and active?
 
its someone elses code:

here it is

Dim r As Integer
Dim doo As Integer
Dim MyErrNumber As Long
Dim MyErrDescription As String
Dim NewRec As Integer
Dim FullToText As String


doo = 0
AmmendEmailList = True
On Error GoTo err1:
Screen.MousePointer = 11
StatBar "Getting Users"

'sign on to email
MDISpecMain.MAPISession1.LogonUI = True
MDISpecMain.MAPISession1.SignOn

MDISpecMain.MAPIMessages1.SessionID = MDISpecMain.MAPISession1.SessionID

'open temp message
MDISpecMain.MAPIMessages1.MsgIndex = -1

'remove any email receps
For r = MDISpecMain.MAPIMessages1.RecipCount To 0 Step -1
MDISpecMain.MAPIMessages1.RecipIndex = r
MDISpecMain.MAPIMessages1.Delete mapRecipientDelete
Next r

NewRec = 0

'fill Recip list with known names
MDISpecMain.MAPIMessages1.AddressResolveUI = True
For r = 0 To MyArray.UpperBound(1)
MDISpecMain.MAPIMessages1.RecipIndex = NewRec
MDISpecMain.MAPIMessages1.RecipDisplayName = MyArray(r, 0)
MDISpecMain.MAPIMessages1.ResolveName
If doo = 1 Then
If Trim$(MyArray(r, 0)) <> "" Then
MsgBox "Invalid Email Address '" & Trim$(MyArray(r, 0)) & "'", vbCritical + vbOKOnly, "User not found"
End If
MDISpecMain.MAPIMessages1.Delete mapRecipientDelete
doo = 0
Else
NewRec = NewRec + 1
End If
Next r

Screen.MousePointer = 0
 
That looks somewhat incomplete (I won't make any other comments about it ...). Where, for example, is the error handler referenced in the early line:

On Error GoTo err1:

This may well be masking the ResolveName error
 
the copy paste didnt get everything.

There is a error handler routine.

the code doesnt error here.

I think we are going to change the email display name.

Thanks for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top