Iniziative dal Forum > Aste, Mercatino e Notizie Utili

Importare i contatti telefonici outlook 2003 in skype e freecall, formato vcard

(1/1)

SC:
per una mia necessità personale ho deciso di creare un paio di vbs script per poter esportare i contatti di outlook 2003 (en: to export outlook contacts to vcard format file) generalmente sincronizzabili col telefonino in un formato file vcard 3 compatibile con skype e freecall, due dei programmi di telefonia voip molto diffusi

www.skype.com
www.freecall.com

ciascuno script creerà un file di testo nella cartella dove viene eseguito lo script, questo file va poi importato tramite le funzioni di importazione di skype (strumenti-> avanzate->importa...)o di freecall (tools-> archive contacts ->restore...)


il codice è rilasciato sotto licenza gpl 2 come è ,quindi si possono fare tutte le modifiche che si vogliono

codice per esportare i contatti per skype

Codice:

--- Codice: ---Rem Copyright under GPL v2 Author Salvo Caligiore
Rem Script For To export outlook 2003 contacts in vcard v3 skypeout Format
Rem script per poter esportare i contatti di outlook in un formato vcard compatibile con skype ottenendone contatti skypeout

On Error Resume Next

Const olFolderContacts = 10
Const Home = " - casa"
Const Mobile = " - cell"
Const Business = " - ufficio"
outfile="vcardskypeout.vcf"

Set fso = CreateObject("Scripting.FileSystemObject")

if not fso.FileExists (contatore)Then fso.CreateTextFile (outfile)

Set OggFile = fso.GetFile (outfile)

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items

Set OggTextStream = OggFile.OpenAsTextStream(2)
For Each objContact In colContacts
    With OggTextStream
 
    If Len(objContact.HomeTelephoneNumber)<>0 Then
    .WriteLine "BEGIN:VCARD"
    .WriteLine "VERSION:3.0"
    .WriteLine "N:" & objContact.FullName & Home
      .WriteLine "X-SKYPE-DISPLAYNAME:" & objContact.FullName & Home
      .WriteLine "X-SKYPE-PSTNNUMBER:" & objContact.HomeTelephoneNumber
      .WriteLine "END:VCARD"
    .WriteLine
End If
If Len(objContact.MobileTelephoneNumber) <> 0 Then
    .WriteLine "BEGIN:VCARD"
    .WriteLine "VERSION:3.0"
    .WriteLine "N:" & objContact.FullName & Mobile
    .WriteLine "X-SKYPE-DISPLAYNAME:" & objContact.FullName & Mobile
    .WriteLine "X-SKYPE-PSTNNUMBER:" & objContact.MobileTelephoneNumber
      .WriteLine "END:VCARD"
    .WriteLine
End If
  If Len(objContact.BusinessTelephoneNumber) <> 0 Then
    .WriteLine "BEGIN:VCARD"
    .WriteLine "VERSION:3.0"
    .WriteLine "N:" & objContact.FullName & Business
    .WriteLine "X-SKYPE-DISPLAYNAME:" & objContact.FullName & Business
    .WriteLine "X-SKYPE-PSTNNUMBER:" & objContact.BusinessTelephoneNumber
.WriteLine "END:VCARD"
    .WriteLine
End If
 
  End With
Next

OggTextStream.Close

MsgBox("Bene file creato con successo col nome " & outfile & " vai su skype->strumenti->avanzate importa contatti da file vcard saluti By SC")

--- Termina codice ---

codice per esportare i contatti su freecall



--- Codice: ---Rem Copyright under GPL v2 Author Salvo Caligiore
Rem Script For To export outlook 2003 contacts in vcard v3 Freecall Format
Rem script per poter esportare i contatti di outlook in un formato vcard compatibile con freecall

On Error Resume Next

Const olFolderContacts = 10
Const Home = " - casa"
Const Mobile = " - cell"
Const Business = " - ufficio"
Const mail =0  Rem 1 se vuoi importare l'indirizzo mail nel file vcard

outfile="freecallvcard.vcf"

Set fso = CreateObject("Scripting.FileSystemObject")

if not fso.FileExists (contatore)Then fso.CreateTextFile (outfile)

Set OggFile = fso.GetFile (outfile)

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items

Set OggTextStream = OggFile.OpenAsTextStream(2)
For Each objContact In colContacts
    With OggTextStream
   
    .WriteLine "BEGIN:VCARD"
    .WriteLine "VERSION:3.0"
    .WriteLine "N:" & objContact.FullName
    .WriteLine "FN:" & objContact.FullName
      .WriteLine "X-VOIP-USERNAME:" & objContact.FullName
      .WriteLine "X-VOIP-PSTNNUMBER:" & objContact.MobileTelephoneNumber
      .WriteLine "X-VOIP-DISPLAYNAME:" & objContact.FullName
  .WriteLine "X-VOIP-SEX:Unknown"
 
    .WriteLine "BDAY:19000101"
  If mail<>0 Then    .WriteLine "EMAIL:" & objContact.Email1Address
 
  .WriteLine "TEL;HOME:" & objContact.HomeTelephoneNumber
  .WriteLine "TEL;CELL:" & objContact.MobileTelephoneNumber
  .WriteLine "TEL;WORK:" & objContact.BusinessTelephoneNumber
  .WriteLine "TEL;FAX:" & objContact.BusinessFaxNumber
  .WriteLine "END:VCARD"
    .WriteLine
  End With
Next

OggTextStream.Close

MsgBox("Bene. file creato con successo col nome " & outfile & "  saluti By SC")
--- Termina codice ---

in realtà in quest'ultimo codice c'è una condizione che determina un errore se il contatto non ha telefonino

P.S. scusate lo stile del codice ma è parecchio che non programmavo , gli script sono allegati al topic (la molletta qua sotto)

Navigazione

[0] Indice dei post

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
Vai alla versione completa