• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Read vCard

Reads a vCard contact from a .vcf file.

Code

using DRIT.Mail.Rfc.VCard;

using var reader = new VCardReader("contact.vcf");
VCard vcard = reader.Read();

Console.WriteLine($"Formatted name: {vcard.FormattedName}");
Console.WriteLine($"Given name:     {vcard.Name?.GivenName}");
Console.WriteLine($"Family name:    {vcard.Name?.FamilyName}");
Console.WriteLine($"Organization:   {vcard.Organization}");

foreach (VCardEmail email in vcard.Emails)
{
    Console.WriteLine($"Email ({email.Type}): {email.Address}");
}

foreach (VCardPhoneNumber phone in vcard.PhoneNumbers)
{
    Console.WriteLine($"Phone ({phone.Type}): {phone.Number}");
}

Remarks

VCardReader parses vCard data as defined in RFC 6350. Both vCard 3.0 and 4.0 are supported.

  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX