An open API service indexing awesome lists of open source software.

https://github.com/detaysoft/vcardparser


https://github.com/detaysoft/vcardparser

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# VCardParser

You can perform VCard decode and encode operations by using the contact class in the project.

The nuget packages is available [here](https://www.nuget.org/packages/VCardParser)
## How to use

* NuGet Command: **Install-Package VCardParser**

* Example
```C#
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
{
new EMail
{
Address = "email@mail.com",
Type = "Home"
},
new EMail
{
Address = "email2@mail.com",
Type = "Company"
},
},
Phones = new List
{
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();
```