Exchange/LDAP address not found

Add-in Express™ Support Service
That's what is more important than anything else

Exchange/LDAP address not found
Emails from Exchange 2013 not finding SMTP address using your code 
Nick Malden Malden




Posts: 23
Joined: 2007-09-25
Exchange 2013/Windows 10/Office 2016
For a while this procedure has worked well

https://www.add-in-express.com/forum/read.php?FID=1&TID=8176

But the line
if AddrBook.ResolveName(Application.Handle, MAPI_DIALOG, nil, AdrList) = S_OK

is returning -2147221245 (not sure what that means) so fails to find the SMTP address.

Seems to work OK with earlier versions of Exchange.

Any ideas please?
Posted 09 Jun, 2017 06:26:26 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Nick,

-2147221245 stands for 80040103‬. A brief googling makes an impression that the issue relates to settings. I suggest that you talk to an administrator.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Jun, 2017 07:11:00 Top
Nick Malden Malden




Posts: 23
Joined: 2007-09-25
Thanks Andrei but I can't find any relevant entries. Could you share a couple of links please?
Nick
Posted 09 Jun, 2017 07:34:20 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
I can't find a relevant page either. The most close match is https://groups.google.com/forum/#!topic/microsoft.public.win32.programmer.messaging/jeQmhlYkEkk. BTW, it suggests another approach: try to ask this question on the Outlook for developers forum at https://social.msdn.microsoft.com/Forums/en-US/home?forum=outlookdev. Please invest in composing the title so that it catches attention of Dmitry Streblechenko; he's mentioned on the page above.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Jun, 2017 07:53:11 Top
Nick Malden Malden




Posts: 23
Joined: 2007-09-25
Thanks - that leads me to believe that what is going wrong is in string conversion prior to the call.

Delphi 5 (original version)
AdrList.aEntries[0].rgPropVals.Value.lpszA := PChar(Address);

if AddrBook.ResolveName(Application.Handle, MAPI_DIALOG, nil, AdrList) = S_OK then begin //no error

Delphi XE5 version
AdrList.aEntries[0].rgPropVals.Value.lpszA := PAnsiChar(Address);

if AddrBook.ResolveName(Application.Handle, MAPI_DIALOG, nil, AdrList) = S_OK then begin //error

I know not strictly your problem, but is there an alternative from changing PChar to PAnsiChar in XE5? Is it a unicode issue?
Posted 09 Jun, 2017 08:12:31 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Nick,

Nick Malden Malden writes:
Is it a unicode issue?


It may be. I've found out that this exception stands for MAPI_E_BAD_CHAR_WIDTH. This is all information I have for today. We are going to test that project in XE5 next week.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Jun, 2017 08:34:24 Top
Nick Malden Malden




Posts: 23
Joined: 2007-09-25
Is there any progress on this please?
Posted 20 Jun, 2017 10:35:36 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Nick,

We've modified the sample project. Please re-download it at https://www.add-in-express.com/files/projects_pub/adx-ol-get-smtp-address-delphi.zip.


Andrei Smolin
Add-in Express Team Leader
Posted 21 Jun, 2017 08:52:37 Top
Nick Malden Malden




Posts: 23
Joined: 2007-09-25
Thanks for the update. I have added the new GetSMTPAddress function, and it gets past the ResolveName issue, but then fails on:

if HrGetOneProp(AddrEntry, PR_EMS_AB_PROXY_ADDRESSES, propAddress) = S_OK then begin

returning a value of -2147024809.

Nick
Posted 22 Jun, 2017 04:52:40 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Nick,

What Outlook version are you using? Is it 32bit or 64bit?


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2017 06:34:37 Top