Fork of MixERP.Net.VCards upgrade to .net core 6 with fixes - VCards is a cross-platform, standard-compliant, lightweight, and forgiving vCard parser written in C# which supports parsing and serializing vCards.
$ dotnet add package MSiH.MixERP.Net.VCardsFork of MixERP.Net.VCards upgrade to .net core 6 and fixes - VCards is a standard-compliant, lightweight, and forgiving vCard parser written in C# which supports parsing and serializing vCards. The following versions are supported:
Download Nuget Package
Install-Package MSiH.MixERP.Net.VCards
Create a vCard
var vcard = new VCard
{
Version = VCardVersion.V4,
FormattedName = "John Doe",
FirstName = "John",
LastName = "Doe",
Classification = ClassificationType.Confidential,
Categories = new[] {"Friend", "Fella", "Amsterdam"},
//...
};
Serialize a vCard and Save as a VCF File
string serialized = vcard.Serialize();
string path = Path.Combine("C:\", "JohnDoe.vcf");
File.WriteAllText(path, serialized);
Parse a VCF File
IEnumerable<VCard> vcards = MixERP.Net.VCards.Deserializer.Deserialize(path);
or
string contents = File.ReadAllText(path, Encoding.UTF8);
IEnumerable<VCard> vcards = MixERP.Net.VCards.Deserializer.GetVCards(contents);
foreach (var vcard in vcards)
{
Console.WriteLine(vcard.FirstName + " \t " + vcard.MiddleName + " " + vcard.LastName);
Console.WriteLine(vcard.FormattedName);
}
Console.ReadLine();
For more info, please see the specifications here
FN string)N string)N string)N string)N string)N string)BDAY string)ADR complex enumerable)LABEL complex)TEL complex enumerable)EMAIL complex enumerable)MAILER string)TITLE string)ROLE string)TITLE TimeZoneInfo)LOGO string, Base64 Encoded)PHOTO string, Base64 Encoded)NOTE string)REV DateTime?)URL Uri)UID string)VERSION enum)ORG string)ORG string)GEO double)GEO double)For more info, please see the RFC 2426 specifications here
NICKNAME string)CATEGORIES string[])SORT-STRING string)SOUND string, Base64 Encoded)KEY string, Base64 Encoded)CLASS enum)For more info, please see the RFC 6350 specifications here
SOURCE Uri)KIND enum)ANNIVERSARY DateTime?)GENDER enum)IMPP complex ienumerable)LANG complex enumerable)RELATED complex enumerable)CALADRURI Uri enumerable)CALURI complex enumerable)