Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>OutlookContacts2CiscoJabberXML.hta</title>
  4. <hta:application scroll="no" windowState="normal">
  5. </head>
  6. <script language="VBScript">
  7.  
  8. sub Window_onLoad()
  9. Window.resizeTo 550, 850
  10. crlf = chr(13) & chr(10)
  11. olFolderContacts = 10
  12.  
  13. Set objShell = CreateObject("WScript.Shell")
  14. oFolder = objShell.expandenvironmentstrings("%userprofile%") & "\Desktop\"
  15.  
  16. set oFSO=CreateObject("Scripting.FileSystemObject")
  17. set oFile=oFSO.CreateTextFile(oFolder & "contacts.xml",2)
  18.  
  19. Set objOutlook = CreateObject("Outlook.Application")
  20. Set objNamespace = objOutlook.GetNamespace("MAPI")
  21. Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
  22.  
  23. xmlOutput = "<?xml version=""1.0"" encoding=""utf-8""?>" & crlf
  24. xmlOutput = xmlOutput & "<buddylist>" & crlf
  25. xmlOutput = xmlOutput & " <group>" & crlf
  26. xmlOutput = xmlOutput & " <gname>Imported</gname>" & crlf
  27.  
  28. On Error Resume Next
  29. For Each objContact In colContacts
  30. If InStr(objContact.Email1Address, "@") > 0 Then
  31. xmlOutput = xmlOutput & " <user>" & crlf
  32. xmlOutput = xmlOutput & " <uname>" & objContact.Email1Address & "</uname>" & crlf
  33. if Len(objContact.FullName) > 0 then
  34. xmlOutput = xmlOutput & " <fname>" & objContact.FullName & "</fname>" & crlf
  35. else
  36. xmlOutput = xmlOutput & " <fname>" & objContact.FirstName & " " & objContact.FirstName &"</fname>" & crlf
  37. end if
  38. if Len(objContact.BusinessTelephoneNumber) > 0 then
  39. xmlOutput = xmlOutput & " <phoneNumber>" & objContact.BusinessTelephoneNumber & "</phoneNumber>" & crlf
  40. else
  41. xmlOutput = xmlOutput & " <phoneNumber>" & objContact.MobileTelephoneNumber & "</phoneNumber>" & crlf
  42. end if
  43. xmlOutput = xmlOutput & " </user>" & crlf
  44. End If
  45. Next
  46.  
  47. xmlOutput = xmlOutput & " </group>" & crlf
  48. xmlOutput = xmlOutput & "</buddylist>" & crlf
  49.  
  50. document.all.xmlTextArea.value=xmlOutput
  51.  
  52. oFile.writeline xmlOutput
  53. oFile.Close
  54. end sub
  55.  
  56. </script>
  57. <body>
  58. <textarea name="xmlTextArea" rows=48 cols=60></textarea><p>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement