PC Review


Reply
Thread Tools Rate Thread

AddressEntry.GetFreeBusy not working in Windows 7

 
 
New Member
Join Date: Sep 2011
Posts: 1
 
      15th Sep 2011
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 by rastus2000; 15th Sep 2011 at 06:34 PM..
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
get contactitem from addressentry sd Microsoft Outlook Program Addins 3 26th Jun 2008 01:54 PM
Getting an AddressEntry by Name =?Utf-8?B?UmE=?= Microsoft Outlook Interoperability 2 14th May 2007 07:38 PM
GetFreeBusy problem Tamir Khason Microsoft C# .NET 3 12th Jul 2004 05:05 PM
ContactItem vs AddressEntry miaplacidus Microsoft Outlook Contacts 3 8th Jul 2004 09:40 PM
Which way should I add an AddressEntry? Shelby Microsoft Outlook VBA Programming 3 15th Jun 2004 02:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:19 AM.