Based on project MixERP.Net.VCards
VCards is a standard-compliant, lightweight, and forgiving vCard parser written in C# which supports parsing and serializing vCards. The following versions are supported:
- Version 2.1
- Version 3.0
- Version 4.0
Download Nuget Package
Install-Package FrApp42.Net.VCards
Create a vCard
varvcard=newVCard{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=FrApp42.Net.VCards.Deserializer.Deserialize(path);or
stringcontents=File.ReadAllText(path,Encoding.UTF8);IEnumerable<VCard>vcards=FrApp42.Net.VCards.Deserializer.GetVCards(contents);foreach(varvcardinvcards){Console.WriteLine(vcard.FirstName+" \t "+vcard.MiddleName+" "+vcard.LastName);Console.WriteLine(vcard.FormattedName);}Console.ReadLine();For more info, please see the specifications here
- Formatted Name (
FNstring) - Last Name (
Nstring) - First Name (
Nstring) - Middle Name (
Nstring) - Prefix (
Nstring) - Suffix (
Nstring) - BirthDay (
BDAYstring) - Addresses (
ADRcomplex enumerable) - Delivery Address (
LABELcomplex) - Telephones (
TELcomplex enumerable) - Emails (
EMAILcomplex enumerable) - Mailer (
MAILERstring) - Title (
TITLEstring) - Role (
ROLEstring) - Time Zone (
TITLETimeZoneInfo) - Logo (
LOGOstring, Base64 Encoded) - Photo (
PHOTOstring, Base64 Encoded) - Note (
NOTEstring) - Last Revision (
REVDateTime?) - Url (
URLUri) - Unique Identifier (
UIDstring) - Version (
VERSIONenum) - Organization (
ORGstring) - Organizational Unit (
ORGstring) - Longitude (
GEOdouble) - Latitude (
GEOdouble)
For more info, please see the RFC 2426 specifications here
- Nick Name (
NICKNAMEstring) - Categories (
CATEGORIESstring[]) - Sort String (
SORT-STRINGstring) - Sound (
SOUNDstring, Base64 Encoded) - Key (
KEYstring, Base64 Encoded) - Classification (
CLASSenum)
For more info, please see the RFC 6350 specifications here
- Source (
SOURCEUri) - Kind (
KINDenum) - Anniversary (
ANNIVERSARYDateTime?) - Gender (
GENDERenum) - Impps (
IMPPcomplex ienumerable) - Languages (
LANGcomplex enumerable) - Relations (
RELATEDcomplex enumerable) - Calendar User Addresses (
CALADRURIUri enumerable) - Calendar Addresses (
CALURIcomplex enumerable)