MFC Visual "C" getting users email addresses

T

Tom at GSD

Hello,

I do not know if this is the correct forum - but to be honest I could not
find a forum that relates to outlook and C++. My question is pretty simple
and prehaps somebody might have an idea how to solve this.

My assignment is to retrieve all USER email addresses from the current
logged on user. I am able to retrieve the primary address - but am unable to
retieve any of the other addresses. Is there a way to get a collection of
user addresses? I have not seen any examples of this in either VB or VC.

Below is a snip of code that I use to get the user address and name. I do
not see any way to get a collection of user addresses if the user has
mutilple emails.

Any help would be greatly appreciated.

_Session* m_pMapiSess;
..
..
..

if(!m_pMapiSess->CreateDispatch("Mapi.session", &e))
{
CString str;
str.Format("CreateDispatch() failed w/error 0x%08lx \n", e.m_sc);
TRACE0(str);

}
else
{
COleVariant vt(DISP_E_PARAMNOTFOUND, VT_ERROR);
_variant_t varSave(false);
_variant_t varDialog(0L);

_variant_t vtReturn = m_pMapiSess->Logon(vt, vt, varSave,
varSave, varDialog, vt, vt);

vtReturn = m_pMapiSess->GetCurrentUser();


AddressEntry_cdo addEntry = vtReturn.pdispVal;


vtReturn = addEntry.GetName();

vtReturn = addEntry.GetAddress();
}

Thanks,
Tom -
 
K

Ken Slovak - [MVP - Outlook]

Have you looked at the PR_EMS_AB_PROXY_ADDRESSES (0x800F101E) PT_MV_STRING8
property? That multivalued field has all the user's email addresses.
 
T

Tom at GSD

Thank you Ken! No I have not looked at that. I was trying to use some
collection object which was not working. In fact I did not know that property
existed. I will check that out. Again - thank you for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top