vbaoutlookoutlook-2013

Using Recipient.FreeBusy in Outlook


I am having trouble using the FreeBusy method of the Recipient class.

The documentation states that the function parameters are:

Start which represents the start time, MinPerChar which represents the minutes per character returned, and CompleteFormat which represents whether you just want to know if the room is busy or additional details about the business.

However, when putting the following code, I get the same results:

 debug.print myRoom.FreeBusy(#10/18/2016 11:00:00 AM#, 30, false)

which gives:

 0000000000000000010000001......

and then:

 debug.print myRoom.FreeBusy(#10/18/2016 10:00:00 AM#, 30, false)

gives the same thing:

 0000000000000000010000001......

What am I doing wrong? I would have thought that the second call would return the first one moved to the right by 2 bits with 2 additional values, but this does not seem to be the case.

I am running Outlook 2013 on an Exchange Server.


Solution

  • The problem seems to be that the Start parameter is a date parameter and not a DateTime parameter, so it will ignore the time, starting at the beginning of the day.

    You just need to count the correct number of output bits to get the correct hour.

    Instead of:

     debug.print myRoom.FreeBusy(#10/18/2016 11:00:00 AM#, 30, false)
    

    Use:

     myVal = myRoom.FreeBusy(#10/18/2016#, 30, false)
     debug.print Mid(myVal, 22, len(myVal) - 22)