Create, Save, and Load Outlook Contacts in C++
Aspose.Email for C++ allows you to create and manage Microsoft Outlook contacts programmatically. The MapiContact class provides all contact-related properties including names, professional info, addresses, email accounts, phone numbers, categories, custom fields, and photos.
This article demonstrates how to create, save, and read Outlook contacts in MSG and vCard (VCF) formats.
Create and Save an Outlook Contact
To create an Outlook contact and save it to disk, follow the steps below:
- Instantiate MapiContact.
- Populate name, professional, personal, and address details.
- Add electronic addresses and telephone numbers.
- Assign categories, mileage, billing, and custom fields.
- Optionally, embed a contact photo.
- Save the contact in MSG or vCard (VCF) format.
The following code sample demonstrates how to create an Outlook contact with detailed personal, professional, and organizational information and save it in different formats:
Read a Contact using MapiContact
The MapiContact class can load Outlook contacts saved in both MSG and VCF formats.
Load a Contact from MSG
The following code sample demonstrates how to load a contact from an Outlook MSG file and convert it to a MapiContact object.
Load a Contact from vCard (VCF)
The following code sample demonstrates how to load contact information from a vCard (VCF) file using two different approaches in Aspose.Email for C++. It shows both the VCardContact class method for direct vCard loading and the MapiContact class method for converting vCard data into an Outlook MAPI contact format, providing flexibility for working with contact data in different application contexts.