If office is already installed on your machine, you can also install Microsoft.Office.Interop.Outlook, and then add an extension method to the code, like this:
class Program
{
static void Main(string[] args)
{
ContactItem contact;
Application app = new Application();
contact = (ContactItem)app.Session.OpenSharedItem(@"d:\1.vcf");
DataTable dataTable = new DataTable();
dataTable.Columns.Add("CompanyName", typeof(string));
dataTable.Columns.Add("E-Mail", typeof(string));
dataTable.AddToDatatable(contact);
Console.WriteLine();
}
}
public static class MyClass
{
public static void AddToDatatable(this DataTable dataTable, ContactItem contactItem)
{
dataTable.Rows.Add(contactItem.CompanyName,contactItem.Email1Address);
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.