View Single Post
  #9  
Old April 24th 07, 10:47 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Can't get SMTP address of contact that shares email address of an Exchange user

That looks fine, you just need to include {} when passing the GUID string:

object result = mapiUtils.GetIDsFromNames(contact.MAPIOBJECT,
"{00062004-0000-0000-C000-000000000046}", 0x8085, false);

Also don't forget to "or" the returned value with PT_BINARY (0x0102). You
can then use MAPIUtils.HrGetOneProp to read that binary prop (variant array
is returned for the binary props), then convert it to a hex string using
MAPIUtils.HrArrayToString


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Jeff" wrote in message
ups.com...
Thanks for the help. I confirmed that your RDO library does get the
SMTP-formatted address that I need. I would like to consider some
other options before I use that work-around.

Regarding your suggestion on reading the property via MAPI, is this
how you would do it via Redemption?

Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
NameSpace nameSpace = app.GetNamespace("MAPI");
ContactItem contact =
nameSpace.GetDefaultFolder(OlDefaultFolders.olFold erContacts).Items[1]
as ContactItem;
MAPIUtils mapiUtils = new MAPIUtils();
object result = mapiUtils.GetIDsFromNames(contact.MAPIOBJECT,
"00062004-0000-0000-C000-000000000046", 0x8085, false);


The call to GetIDsFromNames results in this COMException:

Additional information: Error in _HrGetIDsFromNames - CLSIDFromString
0x800401F3


I'm not sure if that error means that I'm using MAPIUtils wrong, or if
Outlook has a bug, as you suggested.

Thanks,
Jeff



Ads