Moving Contacts from WebMail to HawkMail

 
This document describes how to move contacts from WebMail to the new HawkMail system.

WebMail exports contacts in only one format: VCARD. It exports all of the contacts into a single file named "rcube_contacts.vcf."

HawkMail's (a Microsoft Exchange system) web interface (which is Outlook Web Access, or "OWA") does not import contacts at all. The only way to import contacts into HawkMail (and its OWA interface) is to connect a copy of Microsoft Outlook on a PC to an email account, and then import the VCARD contacts into Outlook, which will insert them into the account.

However, Outlook can only import a single contact per VCARD (.vcf) file -- it will only import the first contact in a file of many, and then stop -- so it can't import the rcube_contacts.vcf file produced/exported by WebMail.

Information Technology Services has developed a VBScript program that gets around this limitation.

 
The Steps:
  • Export the contacts from the WebMail account to a file named rcube_contacts.vcf (which is what WebMail produces by default).

  • Copy the rcube_contacts.vcf file to the Desktop of a network-connected computer with Outook 2010 on it (the VBScript was developed and tested with Outlook 2010, but may work on earlier versions). This transfer could be done via thumb drive, email, or the user could just log into WebMail from the computer itself and export/save the rcube_contacts.vcf file directly to the Desktop.

  • Configure Outlook on the computer to the user's account using the appropriate instructions below:

  • RIGHT-click on the Desktop and make a New -> Text Document -- accept the default name of "New Text Document" for now.

  • Copy and paste the program below into the file:
Option Explicit


' Vcardin.vbs
' Dave Kelley
' 3/12/13
'
' Based on code by Matt Wakeling, 11/1/11
' http://programmingexperiences.blogspot.com/2011/11/importing-multiple-vcf-contact-cards.html


Dim objWSHShell
Dim objOutlook 
Dim objActiveInspector
Dim outfile
Dim infile
Dim lngReturnValue 
Dim olDiscard
Dim inf, outf
Dim p2
Dim thisname

Set outfile = CreateObject("Scripting.FileSystemObject")       
Set infile = CreateObject("Scripting.FileSystemObject")   

Set objWSHShell = CreateObject("WScript.Shell")       

wscript.echo "Multi-card VCard Importer V1.0     March 12, 2013     D. Kelley"
wscript.echo "---------------------------------------------------------------"
set inf=infile.OpenTextFile("rcube_contacts.vcf",1)  ' 1 = For Reading

do While inf.AtEndOfStream <> true

'Pick out a vcard:
  p2 = "zzz"
  set outf=outfile.OpenTextFile("temp.vcf",2,True)   ' 2 = Overwrite
  do While p2 <> "END:VCARD"
    p2=inf.ReadLine
    if(mid(p2,1,3) = "FN:") then
      thisname=mid(p2,4)
    end if
    outf.writeline(p2)
  Loop
  outf.close

'Put it in Outlook:

    Set objOutlook = CreateObject("Outlook.Application")
    If Not(objOutlook Is Nothing) Then 
      lngReturnValue = objWSHShell.Run (Chr(34) & "temp.vcf" & Chr(34), 0, True)

      Set objActiveInspector = objOutlook.ActiveInspector
      objActiveInspector.CurrentItem.Save
      objActiveInspector.CurrentItem.Close olDiscard

      WScript.echo "Imported: " & thisname
      WScript.sleep 2000 
   
      Set objActiveInspector  = Nothing
      Set objOutlook = Nothing
    Else
      WScript.echo "Outlook connection issue, " & thisname & " not imported."
    End If

Loop

Set objWSHShell = Nothing

  • Save the file as "vcardin.vbs": File -> Save As... name it "vcardin.vbs" and change "Save as type" to All files.

  • Now open a command prompt on the computer: Start -> Run and then type CMD and press Enter.

  • When the command window opens, navigate to the Desktop (usually just CD Desktop will do the trick).

  • Run the VBScript program: C:\...\...\Desktop> cscript vcardin.vbs

The program should pop up a window about once every two seconds as it processes each contact in the file. Depending on the configuration of Outlook, the contacts will be uploaded either directly to the HawkMail account, or to a "local" file on the computer where they can be moved out to the HawkMail account.

When done, the files on the desktop can be deleted and the account can be removed from Outlook, or, if it's an Information Technology Services Lab computer, just rebooting the machine should completely remove all traces of the files and configuration from the machine.

 

University of Hartford Information Technology Services
ITS@hartford.edu
860.768.5999