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

Build vCard

Builds a vCard contact and writes it to a file.

Code

using DRIT.Mail.Rfc.VCard;

var builder = new VCardBuilder();
builder.FormattedName = "John Doe";
builder.Name = new VCardName
{
    GivenName = "John",
    FamilyName = "Doe",
};
builder.Organization = "Example Corp";
builder.Emails.Add(new VCardEmail("john.doe@example.com", VCardEmailType.Work));
builder.PhoneNumbers.Add(new VCardPhoneNumber("+1-555-1234", VCardPhoneType.Work));

VCard vcard = builder.ToVCard();

using var writer = new VCardWriter("output.vcf");
writer.Write(vcard);

Remarks

VCardBuilder provides a fluent API for constructing vCards. The resulting VCard object can be serialized with VCardWriter.

  • Improve this Doc
Back to top

DR-IT Software documentation

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

Generated by DocFX