Question

I'm using MapiEx(http://www.codeproject.com/Articles/10881/MAPIEx-Extended-MAPI-Wrapper) to generate a mail.

I need the name and e-mail logged in the MAPI client to set as the sender in the e-mail.

The class CMAPIEx has the methods GetProfileName and GetProfileEmail, but to use those methods, I need to log in the MAPI with the user profile.

In the Login method of CMAPIEx I can pass the ProfileName, but I don't know what to pass.

My MAPI client is Outlook 2010, I tried to pass the e-mail or name that I set in my account, but nothing worked.

I looked the Login method in the CMAPIEx class and I found this:

DWORD dwFlags=MAPI_EXTENDED | MAPI_USE_DEFAULT | MAPI_NEW_SESSION;
if(bInitAsService) dwFlags|=MAPI_EXPLICIT_PROFILE | MAPI_NT_SERVICE;
return (MAPILogonEx(NULL, (LPTSTR)szProfileName, NULL, dwFlags, &m_pSession)==S_OK);

The third parameter of MAPILogonEx is the password and my account in Outlook has a password but in MAPILogonEx documentation(http://msdn.microsoft.com/en-us/library/office/cc815545.aspx) is said to let the password as NULL.

As I said in the second paragraph, I only need the name and e-mail logged in the MAPI client, if somebody knows what I'm doing wrong or some other way to get those information, please tell me.

Sorry for the bad english.

Était-ce utile?

La solution

If you do not pass the profile name, you will end up with the default profile. You can see the names of the existing profiles in Control Panel | Mail | Show Profiles. To enumarate the existing profiles programmatically, use IProfAdmin::GetProfileTable()

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top