How to read free/busy information using CDOEX and VBS?
Below is a .VBS sample... please note that this needs to run from the Exchange server.
'---------------------------------------------------------------------------------------------------------
' getfb.vbs - Get Free/Busy information using CDOEX and VBS
' This code must run from Exchange Server
' Instructions:
' Save to a file called getfb.vbs
' Do the TODO: sections
' Run from the command line using: cscript getfb.vbs
'---------------------------------------------------------------------------------------------------------
Dim strUserToCheck
Dim iAddr
Dim freebusy
dim sServer
dim sFreeBusy
dim strFBFrom
dim strFBTo
strFBFrom = "6/4/2003 8:00:00 AM" ' TODO: Change this
strFBTo = "6/4/2003 6:00:00 PM" ' TODO: Change this
strUserToCheck = "myuser@comapany.com" ' TODO: Change this to match the user's mailbox
strServer = "LDAP://mycompany.com" ' TODO: Change this to the exchange server
Set iAddr = createobject("CDO.Addressee")
iAddr.EmailAddress = strUserToCheck
iAddr.CheckName (strServer)
WScript.echo " -->Resolved Status: " & iAddr.ResolvedStatus ' 0 - Unresolved, 1 - Resolved, 2 - Ambiguous
sFreeBusy = iAddr.GetFreeBusy(strFBFrom, strFBTo, 30)
WScript.echo "Freebusy: " & (sFreeBusy )
' Each element in the array corresponds to the time-span of
' the time interval.
' The meaning of each element is as follows:
' 0 - Available for meetings/appointments during the time slot
' 1 -At least one tentative commitment during the time slot
' 2 -At least one confirmed commitment during the time slot
' 3 -Out-of-office (OOF) for at leastpart of the time slot