AddressEntry.GetFreeBusy not working in Windows 7

Joined
Sep 15, 2011
Messages
1
Reaction score
0
First time post to the forum. I've been programming in VBA for only a few months now. But, am starting to see some success.

So, I've started to share my script with other users. I had some problems getting this particular code to work in Windows 7. It works fine on my XP machine The way it works is that within Outlook Appointment, it searches for open meeting rooms, if available- it prompts the user with a msgbox to choose the available room, or go to the next one.

This works fine on my machine XP. But, when I tried to install on a Windows 7 machine, it does not work. No errors, just does not do anything. I added msgboxes to troubleshoot and see how far it gets. It is able to find the conference rooms, and extract the meeting time, convert it to minutes, but when it gets to, AddressEntry.GetFreeBusy, it would not do anything. When I was working on my XP, I was able to see a series of 1's and 0's, which let me know it was receiving the busy/free information from the server.

Finally, I enabled all macros, and added a self-signed, root trusted, certificate to the Window 7 machine, and received the same result. The macro can execute all code except for the "AddressEntry.GetFreeBusy"

This works great on my XP, so hopefully someone can get some use for it. But, can't figure out what the problem is on the Windows 7 machine. This is not my own original work, I found this from a posting from "callmedoug" and modified it for my purposes, added the input control.


Thanks in advance- Trevor






Option Explicit
Dim strCity As String 'city code used in address name
Dim strRooms As String 'address entries
Dim Meeting 'current meeting
Dim myRecipient 'the room I finally pick
Dim UseThisRoom 'the room I finally pick
Dim myAddressList As AddressList 'address list
Dim AddressEntry As AddressEntry 'addressentry

Sub GetRooms()
Dim choice As Integer
'use the global address book, incase another is default
Set myAddressList = Application.Session.AddressLists("Global Address List")
' go through address book and get each meeting room
For Each AddressEntry In myAddressList.AddressEntries
strRooms = AddressEntry.Name
'look only at conf entries (all room nanmes begin with CPR)
If Left(strRooms, 3) = "CPR" Then
'look for the available rooms
Call GetFreeBusyInfo
End If

Next


End Sub

Sub GetFreeBusyInfo()
Dim choice As String
Dim myFBInfo As String 'getfreebusy information for the meeting date
Dim MyStart 'meeting start tiem and date
Dim MyDur 'number of minutes in length the meeting is
Dim MyStartTime 'number of minutes after midnight meeting starts
'use the active meeting as reference
Set Meeting = Outlook.ActiveInspector.CurrentItem
MyStart = Meeting.Start 'get the meeting start from active meeting
MyDur = Meeting.Duration - 2 '

'get number of minutes between midnight and MyStart

MyStartTime = DateDiff("n", Format(MyStart, "Short Date"), MyStart) + 1 'ADDED +1 to offset meeting

On Error GoTo ErrorHandler 'ignore rooms that where freebusy is not available
'get the freebusy time for the meetign date
myFBInfo = AddressEntry.GetFreeBusy(MyStart, 1)
'MsgBox myFBInfo

'see if time is available (all minutes within meeting duration are0)
If Mid(myFBInfo, MyStartTime, MyDur) = 0 Then
'if available add it to the listbox
Dim response As VbMsgBoxResult
response = MsgBox("Book" & strRooms & " Conference Room?", vbQuestion + vbYesNoCancel)
If response = vbYes Then

UseThisRoom = strRooms
'add the selected room to current object as a resource
Set Meeting = Outlook.ActiveInspector.CurrentItem
Set myRecipient = Meeting.Recipients.Add(UseThisRoom)
myRecipient.Type = olResource
End


ElseIf response = vbCancel Then End
Else
Exit Sub
End If

End If

ErrorHandler:

End Sub
 
Last edited:
Back
Top