You can perform VCard decode and encode operations by using the contact class in the project.
The nuget packages is available here
-
NuGet Command: Install-Package VCardParser
-
Example
using VCardParser.Helpers;
using VCardParser.Models;
Contact contact = new Contact
{
FirstName = "FirstName",
LastName = "LastName",
FormattedName = "FirstName LastName",
Organization = "Company",
OrganizationPosition = "Team",
Title = "Title",
Photo = "base64foto",
Emails = new List<EMail>
{
new EMail
{
Address = "[email protected]",
Type = "Home"
},
new EMail
{
Address = "[email protected]",
Type = "Company"
},
},
Phones = new List<Phone>
{
new Phone
{
Number = "01111111111",
Type = "Cell"
},
new Phone
{
Number = "+902222222222",
Type = "Company"
},
}
};
// encode contact model for creating vcard file
var encodedVCard = contact.EncodeVCard();
Console.WriteLine(encodedVCard);
// exporting vcf file
File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filename.vcf"), encodedVCard);
// decode vcard file from vcf file to contact model
encodedVCard.DecodeVCard();