Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created September 26, 2025 15:54
Show Gist options
  • Save aspose-com-gists/b12c7d98fd02de779bb1b8d8e0a2ab4d to your computer and use it in GitHub Desktop.
Save aspose-com-gists/b12c7d98fd02de779bb1b8d8e0a2ab4d to your computer and use it in GitHub Desktop.
Read and Convert Multi-Contact VCF Files in C#
bool hasMultipleContacts = VCardContact.IsMultiContacts("multi_contacts.vcf");
Console.WriteLine("The VCF file contains multiple contacts: " + hasMultipleContacts);
// Create a distribution list from the VCF file
var distributionList = MapiDistributionList.FromVCF("multi_contacts.vcf");
// Save as MSG
distributionList.Save("contacts.msg", new MapiDistributionListSaveOptions(ContactSaveFormat.Msg));
// Load all contacts from the VCF file
var contacts = VCardContact.LoadAsMultiple("multi_contacts.vcf");
Console.WriteLine("Total contacts loaded: " + contacts.Count);
foreach (var contact in contacts)
{
Console.WriteLine("Contact: " + contact.IdentificationInfo.DisplayName);
}
var saveOptions = new MapiDistributionListSaveOptions(ContactSaveFormat.VCard);
distributionList.Save("saved_contacts.vcf", saveOptions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment