Shinyshoes
Member
I wanted to be able to read the appointment information from outlook into premise. I found some scripts on the internet to accomplish this, but they don't work correctly in Premise. If I run them from a .vbs file it does what I want it to, but if i run it from premise it hangs without any error messages. I tried using a shell command (wscript.shell or shell.application) to launch the .vbs file and I'm not having success.
Is there a different way to connect to outlook that I am unaware of? otherwise, is there a way I can launch this .vbs script on the hard drive from within premise?
For reference, below is a truncated version of my code.
dim filesys, filetxt
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("c:\somefile.txt", 2, True)
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
set objFolder = objNS.GetDefaultFolder(9)
Set colCal = objFolder.Items
dtestart = date
dteEnd = date
colCal.Sort "[Start]"
colCal.IncludeRecurrences = True
strFind = "[Start] <= " & Quote(Formatdatetime(dteEnd, 2) & " 11:59 PM") & " AND [End] > " & Quote(Formatdatetime(dteStart, 2) & " 12:00 AM")
Set colSpanItems = colCal.Restrict(strFind)
For Each objAppt In colSpanItems
filetxt.writeline "At " & objappt.start & ": " & objAppt.Subject & "."
Next
Set objAppt = Nothing
Set colSpanItems = Nothing
Set colCal = Nothing
set objFolder = Nothing
set objNS = nothing
set objOL = nothing
Is there a different way to connect to outlook that I am unaware of? otherwise, is there a way I can launch this .vbs script on the hard drive from within premise?
For reference, below is a truncated version of my code.
dim filesys, filetxt
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile("c:\somefile.txt", 2, True)
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
set objFolder = objNS.GetDefaultFolder(9)
Set colCal = objFolder.Items
dtestart = date
dteEnd = date
colCal.Sort "[Start]"
colCal.IncludeRecurrences = True
strFind = "[Start] <= " & Quote(Formatdatetime(dteEnd, 2) & " 11:59 PM") & " AND [End] > " & Quote(Formatdatetime(dteStart, 2) & " 12:00 AM")
Set colSpanItems = colCal.Restrict(strFind)
For Each objAppt In colSpanItems
filetxt.writeline "At " & objappt.start & ": " & objAppt.Subject & "."
Next
Set objAppt = Nothing
Set colSpanItems = Nothing
Set colCal = Nothing
set objFolder = Nothing
set objNS = nothing
set objOL = nothing