Skype contacts. Import to Outlook 2013


Exporting Skype contacts.

I was tasked, exporting a number of users’ Skype contacts, during a move from Skype accounts to corporate Lync. The accounts were not bound via Outlook.com så you couldnt “just see them” in Outlook as one might expect.

 

It all fine at first. Depending on language, you simply open Skype, go to the contacts menu, advanced and select backup/export contacts. This creates a fine .vcf file. Great! Fast and easy.

 

Now – simply open Outlook,

  • goto People
  • File –> import/export
  • Import Contact from .vcf file

You cant miss it. But wait a minute.. you just KNOW there was omore than one contact in Skype, but Outlook only added one ?  (the first).

And this is where the trouble starts. Because – this is Outlook by design. It cannot handle more than 1 contact pr. .vcf file. Im not making this up!

After searching the interweb, i just gave up. Funny VBA macros, Commercial programs, 3. party solutions, online converters to .csv files, and so on. By the end of the day, i just gave up..

I ended up with a simple solution. Why not – just make a “funny” script, to split the multi-contact .vcf file into a file per contact, and just drag them into Outlook. I will only be doing this once, so i kan live with about a hundred contacts.

This script was very easy and fast done. Ok – i skiped a lot of error handling – but it Works – and its a fairly simple 3 step procedure.

1: Open Skype, go to contacts –> advanced and Backup/Export
2: Run the script, select your exported file, and press ok
3: Open Outlook, and drag the new files into contacts.

SO… if you want the script – its right here.. AS IS.. (i mailed a linkt to the script on a Network drive, and let people do it them selfs).

Hope you can use it – Enjoy 🙂

'--------------------------------------------------------------------------------------------
' Daniel A. Lauritzen
' Split VCF with multiple contacts into "one file per contact". 
' This is because of outlook, lacking the ability to read more than 
' only 1 contact - event thou there are loads of them in a VCF file... GG Microsoft..... 
'--------------------------------------------------------------------------------------------
DIM objFSO , infile, newcard, InFileName 
DIM buf, CardBuf, Incard, N

InFileName = ChooseFile( ) 
if InFilename = "" then  
   msgbox "No filename was received, exiting."  
   WScript.Quit 1 
end if 

DestPath =  left(InFileName,(InStrRev(InFileName,"\"))) & "Contacts"
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set inFile = objFSO.OpenTextFile (InFileName, 1)
If NOT (objFSO.FolderExists(DestPath)) then objFSO.CreateFolder(DestPath)

Incard = 0 
CardBuf = "" 
nContacts = 0

Do while not inFile.AtEndOfStream
   buf = infile.readline
   if (buf =  "BEGIN:VCARD" ) then   
      incard = 1   
      CardBuf = ""   
      N = ""   
      nContacts = nContacts + 1  
   end if

   if (Incard) then
      Cardbuf = Cardbuf & buf & vbCrLf   
      if (Left(buf,2) = "N:" ) then
         N = replace(buf,"N:","")' Lets use the Contact name as filename
         N = replace(N,":","-")  ' aparently some are called live:*   and : is bad for filenames...  
      end if
   if (buf =  "END:VCARD" ) then   
      incard = 0
      Set newcard = objfso.CreateTextFile("""" & DestPath & "\" & N & ".vcf""", True)  
                                                            ' All the "'s are for filenames with spaces.    
      newcard.WriteLine(CardBuf)
      newcard.Close  
   end if
loop
infile.close

msgbox "Splitting completed. " & nContacts & " were created in the Contacts folder next to the original .vcf file."

'------------------------------------------------------------------------------------ 
'' THIS HUGE HTA PART is JUST the "file open thingy" - and i STOLE it... from some forum :) 
'------------------------------------------------------------------------------------ 
Function ChooseFile( )   
 Dim objFSO, objShell, objTempFolder, strTempFileName, strFullTempFileName
 Dim objOpenFile, objTextFile, strTempTextFileName   
Const TemporaryFolder = 2   
Const ForReading = 1   
strTempFileName = "OpenFile.hta"   
strTempTextFileName = "OpenFile.txt"   
Set objFSO= CreateObject("Scripting.FileSystemObject")   
Set objTempFolder = objFSO.GetSpecialFolder(TemporaryFolder)   
strFullTempFileName=objTempFolder.Path & "\" & strTempFileName   
Set objOpenFile = objFSO.CreateTextFile(strFullTempFileName,True)   
objOpenFile.writeline("<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1252"">")
objOpenFile.writeline("<title>Open File</title>")   objOpenFile.writeline("<script language=""vbscript"">")   
objOpenFile.writeline("Sub Window_Onload")   
objOpenFile.writeline("FileName.click")   
objOpenFile.writeline("WriteFile FileName.value")   
objOpenFile.writeline("Self.Close()")   
objOpenFile.writeline("End Sub")   
objOpenFile.writeline("Sub WriteFile(strFileName)")   
objOpenFile.writeline("Dim objFSO, objTempFolder, strTempFileName, strFullTempFileName, objOpenFile")   
objOpenFile.writeline("Const TemporaryFolder = 2")   
objOpenFile.writeline("strTempFileName = ""OpenFile.txt""")   
objOpenFile.writeline("Set objFSO=CreateObject(""Scripting.FileSystemObject"")")   
objOpenFile.writeline("Set objTempFolder = objFSO.GetSpecialFolder(TemporaryFolder)")   
objOpenFile.writeline("strFullTempFileName=objTempFolder.Path & ""\"" & strTempFileName")   
objOpenFile.writeline("Set objOpenFile = objFSO.CreateTextFile(strFullTempFileName,True)")   
objOpenFile.writeline("objOpenFile.writeline(strFileName)")   
objOpenFile.writeline("objOpenFile.Close")   
objOpenFile.writeline("Set objFSO=Nothing")   
objOpenFile.writeline("Set objTempFolder=Nothing")   
objOpenFile.writeline("Set objSleepFile=Nothing")   
objOpenFile.writeline("Set objShell=Nothing")   
objOpenFile.writeline("End Sub")   
objOpenFile.writeline("</script>")   
objOpenFile.writeline("<hta:application applicationname=""Open File"" border=""dialog"" borderstyle=""normal"" caption=""Open File"" contextmenu=""no"" maximizebutton=""no"" minimizebutton=""no"" navigable=""no"" scroll=""no"" selection=""no"" showintaskbar=""no"" singleinstance=""yes"" sysmenu=""no"" version=""1.0"" windowstate=""minimize"">")   
objOpenFile.writeline("</head>")   
objOpenFile.writeline("<body>")   
objOpenFile.writeline("<input Application=""True"" type=""file"" id=""FileName"" />")   
objOpenFile.writeline("</body>")   objOpenFile.writeline("</html>")   
objOpenFile.Close   Set objShell = CreateObject("WScript.Shell")   
objShell.Run "mshta.exe " & strFullTempFileName,0,True   
objFSO.DeleteFile strFullTempFileName, True   
Set objShell=Nothing   
Set objOpenFile=Nothing   
strFullTempFileName = objTempFolder.Path & "\" & strTempTextFileName   
Set objTextFile=objFSO.OpenTextFile(strFullTempFileName, ForReading)   
ChooseFile = objTextFile.ReadLine   
objTextFile.Close   
objFSO.DeleteFile strFullTempFileName, True   
Set objTextFile=Nothing   
Set objFSO=Nothing   
Set objTempFolder=Nothing  
End Function

 

Leave a comment

Your email address will not be published. Required fields are marked *