Created
September 26, 2025 15:54
-
-
Save aspose-com-gists/b12c7d98fd02de779bb1b8d8e0a2ab4d to your computer and use it in GitHub Desktop.
Read and Convert Multi-Contact VCF Files in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool hasMultipleContacts = VCardContact.IsMultiContacts("multi_contacts.vcf"); | |
Console.WriteLine("The VCF file contains multiple contacts: " + hasMultipleContacts); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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