Create a new contact use MAPI?

R

ryotyankou

My application UI have a button, click the button, pop up outlook's new
contact dialog, let user fill their infos then save. Then i want to update my
contact list(add this new one to existing list).
I want to call the contact dialog use MAPI, like you click "new contact" in
outlook "new" menu. I checked code of MFCMAPI, found it really hard to do
this(too many codes). My real trouble is i want to know when user close and
save the contact called by my application so to update my list of contacts.
Any ideas? TIA.
 
D

Dmitry Streblechenko

I am not sure what this has to do with creating a new contact.
Have you looked at the Inspector.Close event?

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

ryotyankou via OfficeKB.com

Thank you Dmitry, i solved this problem by use outlook object model.
This is the code:
Outlook::_ApplicationPtr pOutlook("Outlook.Application");
Outlook::_NameSpacePtr pNameSpace = pOutlook->GetNamespace("MAPI");

CString profname = session.GetProfileName();
pNameSpace->Logon(_variant_t(profname) );
CComQIPtr<Outlook::_ContactItem> ocontact(pOutlook->CreateItem(Outlook::
olContactItem));
ocontact->Display((VARIANT_BOOL)1);
---------------------------------------------------------------
And it didn't pop up the security dialog.

Dmitry said:
I am not sure what this has to do with creating a new contact.
Have you looked at the Inspector.Close event?
My application UI have a button, click the button, pop up outlook's new
contact dialog, let user fill their infos then save. Then i want to update
[quoted text clipped - 8 lines]
contacts.
Any ideas? TIA.
 

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