OUTLOOK 2007 IS LAME WHEN VCF FILE CONTAINS > 1 ITEM

W

William McIlroy

Outlook 2007 will only import the first item in a multiple-item VCF file.
This is hugely annoying to businessmen (and women). I have a tested the
following working solution. First, run the following C# program against the
VCF file to split the items into multiple files. Next, run the following
skeleton to produce a VBScript file. Then, open the command prompt and
Outlook 2007. With nothing else going on in your computer (like AIM or
something else that might disrupt your screen environment), run the VBScript
from the command prompt using wscript. DO NOT TOUCH THE KEYBOARD OR MOUSE!
This will insert in all completeness the data in the VCF. You will find them
in your Contacts. Outlook 2007 permits you to create a PST file of the
Contacts.

The C# program:

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace VCARD_SPLITTER
{
class Program
{

/*

BEGIN:VCARD
VERSION:2.1
N:xxxxx;xxxxx
TEL;CELL:0000000000
END:VCARD
BEGIN:VCARD
VERSION:2.1
N:ccccc;cccc
TEL;WORK:2020000000
END:VCARD

*/

static void Main(string[] args)
{
List<CONTACT> ListOfContacts = new List<CONTACT>();
int linecount = 0;
int contactNumber = 0;
CONTACT cntct = null;
using (StreamReader sr = new
StreamReader(@"C:\Users\Ugen\Documents\Whole Phonebook.vcf"))
{
for (; ; )
{
string line = sr.ReadLine();
if (line == null)
break;
linecount++;
if (line.Equals("END:VCARD"))
{
if (cntct != null)
{
cntct.Add(line);
contactNumber++;
string newfilename =
@"C:\Users\Ugen\Documents\manyContacts\" + contactNumber.ToString() + ".VCF";
using (StreamWriter sw = new
StreamWriter(newfilename))
{
int numberOfLines = cntct.GetLength();
int i;
for (i = 0; i < numberOfLines; i++)
sw.WriteLine(cntct.GetString(i));
cntct = null;
}

}
}
else if (line.Equals("BEGIN:VCARD"))
{
cntct = new CONTACT();
cntct.Add(line);
}
else
cntct.Add(line);
}
}

Console.WriteLine("Done. " + linecount.ToString() + " lines.");
}
}
}


The SSG skeleton:


Dim oShell
Set oShell = CreateObject("Wscript.Shell")
oShell.AppActivate "Outlook"
*INCREMENT Z TO 430
oShell.AppActivate "Outlook"
Wscript.Sleep(1000)
oShell.SendKeys "%F"
*INCREMENT X TO 5
Wscript.Sleep(2000)
oShell.SendKeys "{DOWN}"
*LOOP
Wscript.Sleep(1000)
oShell.SendKeys "{ENTER}"
Wscript.Sleep(1000)
*INCREMENT Y TO 2
oShell.SendKeys "{HOME}"
Wscript.Sleep(1000)
*LOOP
*INCREMENT Y TO 2
oShell.SendKeys "{DOWN}"
Wscript.Sleep(1000)
*LOOP
oShell.SendKeys "{ENTER}"
Wscript.Sleep(1000)
oShell.SendKeys "C:\Users\Ugen\Documents\manyContacts\[*Z].VCF"
Wscript.Sleep(2000)
oShell.SendKeys "{ENTER}"
Wscript.Sleep(5000)
*LOOP

--
William McIlroy


----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...9890dbe8&dg=microsoft.public.outlook.contacts
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top