VCF Vcard import c#

Related searches

iam trying to write a class which imports *.vcf files (Vcard), because i didn´t found a adequate .net class to solve that job.

So i decided to treat the *.vcf file like a *.txt file. I just import the whole file, line by line, with a StreamReader. Finally i save the line into a List object.

The Code:

 private List<string> vcardList = new List<String>();
    public Form1()

    private void Form1_Load(object sender, EventArgs e)
        using (StreamReader reader = new StreamReader(@"H:\VS.vcf"))
            string line;
            while ((line = reader.ReadLine()) != null)

After importing the text i needed to edit the lines, because i need to remove all the unnecessary symbols. I tried to use the RedEx claa:

private void button1_Click(object sender, EventArgs e)
        vcardList[0] = Regex.Replace(vcardList[0], "BEGIN:", string.Empty);          

that works very well, for the first line! but the *.vcf file is very complex and allways different.

So my question is: Is there a better way to solve that problem?

This is the *.vcf file:

FN;CHARSET=Windows-1252:Test Mustermann (geschäftlich)
ORG:Mustermann CompanyTITLE;CHARSET=Windows-1252:CEO
TEL;WORK;VOICE:0049 1111 22 769 23 - 1
TEL;CELL;VOICE:0049 2222 33 71 55 90
ADR;WORK;PREF;CHARSET=Windows-1252:;;Frobuehl 22;Gothtown;;101092;England
101092 Frobuehl 

I only need the name and address. Thanks in advance

Pretty old, but it still works:

Create a Contact item from a vCard file and save the item in a folder , Here Mudassar Ahmed Khan has explained how to read vCard (.VCF) Contact Card file and import its information using C# and VB.Net. Here Mudassar Ahmed Khan has explained how to read vCard (.VCF) Contact Card file and import its information using C# and VB.Net.In this article I will illustrate how to read, import and display vCard (.VCF) Contact Card file in ASP.Net. Download Download Free Files API.

You can try to use this sample.

Read and Import vCard (.VCF) file information using C# and VB.Net, vCard Serializer and Parser for C# A .NET class library that allows you to import data from different sources into a unified destination vcf file reader. Tell me more about vCards. A vCard enables you to send contact information in a format that can be easily read in other e-mail programs. A vCard is saved as a .vcf file, which is the Internet standard for sharing contact information. When you send a vCard, its .vcf file is sent with the message as an attachment.

Helle, sry for the long delay.

I solved my problem now with the follwing code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace WindowsFormsApplication1
public partial class Form1 : Form
    public Form1()

    private void Form1_Load(object sender, EventArgs e)
        Outlook.ContactItem contact;
        Outlook.Application app = new Outlook.Application();

        contact = (Outlook.ContactItem)app.Session.OpenSharedItem(@"C:\vv.vfc");

This is just an example of how to easily import a VCF file with C# . i hope this helps. Of course i wouldnt implement it in that way, i rather would create a method with a parameter "incomingFile" or smth else.


vcard � GitHub Topics � GitHub, A .NET standard library for reading vCard files . T this library supports reading multiple contacts from a single vcf file, a stream or a Import the namespaces:. To move vCard to Outlook, an Import function is available in Ms-Outlook, but it works for 1 VCF file at a time. In addition to that, this facility is not suitable for importing a complete folder. For instance, you have lots of contacts then, it will be a tedious task to import single VCF file one by one.

C# purely does not has specific method or class for work with vcfs. But these solutions can be way.last one is the best:

1.Work with Ohhh will open outlook first and then after steps you can do your work.surely its not best solution.

2.Use Thought vcard.its not too bad but image that you have multiple vcfs and you merge them in one vcf.with this package its too hard(or almost impossible) to work with it.

3.Use VCardlib .it doesnt has previous problem but its not update for work with vcf version4 until now.

  1. I use [MixERP.NET.VCard][۳] and its more simple and effective.

bolorundurowb/vCardLib: A .NET standard library for , how to import vcf file data into gridview..please help me out. 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

the solution with the outlook application is not effictive.

Outlook.Application app = new Outlook.Application();

this will open the outlook first. and actually you need only to open the vcard and parse it to extract the information you want from it.

Import vCard (.VCF) file data using C# and VB.Net, d) Run the copy B*vcf all_in_one.vcf cmdlet and proceed with approach to import multiple vCards into Outlook e) Wait for a while, until-and-unless the statement of process completion does not comes in front of you.

Choose Import to a VCARD file (.vcf) from the various options present and then click on Next. From the next screen, select the destination location where you want to save the imported VCF file. At last, click Next followed by Finish. After the complete procedure is done, the VCF files can be opened in MS Outlook.

To import all your contacts in one click: Save all contacts in one folder. Open cmd Go to the folder where you saved contacts using . cd "folder" Run the following command: type *.vcf > all_contacts.vcf. Now you just have to import the all_contacts.vcd contact and all contacts are imported

Import a vCard from an Outlook email message To save vCards you receive as attachments as new contacts, add each vCard one-by-one to the list of Outlook contacts. In the body of the email message, click a vCard, right-click it, and then click Add to Outlook Contacts. A new window appears, displaying the contact information.

  • Just a link is not an answer, danyloid, please explain at least what the sample does.