J
Jeff
I created a contact in Outlook 2003, then I gave that contact an email
address that matches the email address of an Exchange user. When I
access this contact using Outlook COM, I now get the Exchange address
("//o=Company/ou=First Administrative Group/cn=Recipients/cn=0001234")
instead of the address I typed into the contact ("(e-mail address removed)").
I implemented Ken Slovak's suggestions "To get the SMTP address
instead of the Exchange distinguished name", found here (http://
groups.google.com/group/microsoft.public.outlook.program_vba/
browse_thread/thread/60231601429b1156/811ce165ff5854df?lnk=st&q=outlook
+com+get+smtp+email+address+of+contact&rnum=3#811ce165ff5854df)
I also implemented Dmitry's instructions "Default SMTP address of an
Exchange user" found here (http://www.dimastr.com/redemption/
utils.htm)
I think those instructions don't apply b/c of the fact that the
ContactItem i created isn't really an Exchange user, but merely shares
an email address w/ an Exchange user.
I know how to get the SMTP addresses from a MailItem, so please don't
give me help with that.
Any ideas?
Thanks in advance!
Jeff
Here's (C#) code that illustrates the problem. I included the return
values in the comments:
//get the contact I created for this test...
Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
NameSpace ns = app.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder folder =
ns.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
ContactItem contact = folder.Items[1] as ContactItem;
MAPIUtils utils = new MAPIUtils();
//define properties...
int PR_EMS_AB_PROXY_ADDRESSES = unchecked((int)0x800f101e);
const int g_PR_SMTP_ADDRESS_W = unchecked((int)0x39FE001E);
//analyze the ContactItem
string emailAddress = contact.Email1Address;//o=Company/ou=First
Administrative Group/cn=Recipients/cn=0001234
string emailAddressType = contact.Email1AddressType;//EX
object contactProp1 = utils.HrGetOneProp(contact.MAPIOBJECT,
PR_EMS_AB_PROXY_ADDRESSES);//null
object contactProp2 = utils.HrGetOneProp(contact.MAPIOBJECT,
g_PR_SMTP_ADDRESS_W);//null
//analyze the AddressEntry
Redemption.AddressEntry addressEntry =
utils.GetAddressEntryFromID(contact.EntryID) as
Redemption.AddressEntry;
string addressEntryAddress = addressEntry.Address;//null
object addressEntryProp1 = utils.HrGetOneProp(addressEntry.MAPIOBJECT,
PR_EMS_AB_PROXY_ADDRESSES);//null
object addressEntryProp2 = utils.HrGetOneProp(addressEntry.MAPIOBJECT,
g_PR_SMTP_ADDRESS_W);//null
address that matches the email address of an Exchange user. When I
access this contact using Outlook COM, I now get the Exchange address
("//o=Company/ou=First Administrative Group/cn=Recipients/cn=0001234")
instead of the address I typed into the contact ("(e-mail address removed)").
I implemented Ken Slovak's suggestions "To get the SMTP address
instead of the Exchange distinguished name", found here (http://
groups.google.com/group/microsoft.public.outlook.program_vba/
browse_thread/thread/60231601429b1156/811ce165ff5854df?lnk=st&q=outlook
+com+get+smtp+email+address+of+contact&rnum=3#811ce165ff5854df)
I also implemented Dmitry's instructions "Default SMTP address of an
Exchange user" found here (http://www.dimastr.com/redemption/
utils.htm)
I think those instructions don't apply b/c of the fact that the
ContactItem i created isn't really an Exchange user, but merely shares
an email address w/ an Exchange user.
I know how to get the SMTP addresses from a MailItem, so please don't
give me help with that.
Any ideas?
Thanks in advance!
Jeff
Here's (C#) code that illustrates the problem. I included the return
values in the comments:
//get the contact I created for this test...
Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
NameSpace ns = app.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder folder =
ns.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
ContactItem contact = folder.Items[1] as ContactItem;
MAPIUtils utils = new MAPIUtils();
//define properties...
int PR_EMS_AB_PROXY_ADDRESSES = unchecked((int)0x800f101e);
const int g_PR_SMTP_ADDRESS_W = unchecked((int)0x39FE001E);
//analyze the ContactItem
string emailAddress = contact.Email1Address;//o=Company/ou=First
Administrative Group/cn=Recipients/cn=0001234
string emailAddressType = contact.Email1AddressType;//EX
object contactProp1 = utils.HrGetOneProp(contact.MAPIOBJECT,
PR_EMS_AB_PROXY_ADDRESSES);//null
object contactProp2 = utils.HrGetOneProp(contact.MAPIOBJECT,
g_PR_SMTP_ADDRESS_W);//null
//analyze the AddressEntry
Redemption.AddressEntry addressEntry =
utils.GetAddressEntryFromID(contact.EntryID) as
Redemption.AddressEntry;
string addressEntryAddress = addressEntry.Address;//null
object addressEntryProp1 = utils.HrGetOneProp(addressEntry.MAPIOBJECT,
PR_EMS_AB_PROXY_ADDRESSES);//null
object addressEntryProp2 = utils.HrGetOneProp(addressEntry.MAPIOBJECT,
g_PR_SMTP_ADDRESS_W);//null