Working with MSG and VCF Contacts using C++

Contacts are an essential part of any email client as they facilitate the user by remembering all their contacts, similar to the contacts on your smartphone. Outlook contacts store a lot of information regarding a person, such as their name, address, contact number, email address, etc. These contacts can be stored in MSG and VCF formats. You might find yourself in scenarios where you need to create or alter MSG or VCF contacts programmatically. For that, this article will teach you how to work with MSG and VCF contacts using C++.

C++ API for Working with MSG and VCF Contacts

Aspose.Email for C++ is a native C++ library for creating, manipulating, and sending emails without requiring Microsoft Outlook to be installed. The API also supports working with contacts and calendars. You can either install the API through NuGet or download it directly from the Downloads section.

PM> Install-Package Aspose.Email.Cpp

Create MSG and VCF Contacts

In this section, you will learn how to create an Outlook contact and save it in MSG and VCF format. The following are the steps to achieve that.

The following sample code demonstrates how to create an Outlook contact and save it in MSG and VCF format using C++.

Contact generated by the sample code
Contact generated by the sample code

Read MSG and VCF Contacts

Aspose.Email for C++ supports reading contacts in both MSG and VCF formats. Here, you will see how to open MSG and VCF contacts using C++.

Read MSG Contact

The following are the steps to read an MSG contact.

The following is the sample code to read an MSG contact using C++.

Open VCF Contact

To read a VCF contact, simply load the contact using the MapiContact::FromVCard method. The following sample code shows how to read a VCF contact using C++.

Modify MSG and VCF Contacts

In order to modify an MSG/VCF contact, open the contact as demonstrated in the previous section and then change its properties. The following are the steps to modify contacts.

The following sample code demonstrates how to modify MSG/VCF contacts using C++.

Get a Free License

You can try the API without evaluation limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to work with MSG and VCF contacts using C++. Specifically, you have learned how to create, read and modify contacts using Aspose.Email for C++ API. The API provides a bunch of additional features for automating your email-related tasks. You can explore the API in detail by visiting the official documentation. If you have any questions, please feel free to reach us on our free support forum.

See Also