Thursday, October 26, 2006

Showing which mailboxes have been enabled with Outlook Direct Booking via a script

Outlook direct booking is one of the many ways in which you can handle resource mailboxes in Exchange for a full list of other methods have a look at slipstick. Knowing which mailboxes have been enabled in your Exchange Organization could be a little tricky to keep a track of if you have a large number of mailboxes. One method of finding what mailboxes are using Direct booking is by using the freebusy data on a server. How Free-Busy data works and is stored is documented on Technet and this post on the Exchange Team Blog . The Free Busy data also comes into to play with Outlook Direct booking. When a user configures direct booking via the 3 check boxes under resource scheduling in Outlook – Calendar options there are 3 Mapi properties that get set on the local freebusy object in a mailbox. (Note this is not the only thing that happens you do enable direct booking permissions are also modified on the calendar and freebusy object in the resource mailbox)

Automatically accept meeting and process cancellations relates to 0x686D000B
Automatically decline conflicting meeting requests relates to 0x686F000B
Automatically decline recurring meeting requests relates to 0x686E000B

These properties are also published on the users freebusy object located in the SCHEDULE+ FREE BUSY public folder. When a user creates an appointment and selects a mailbox as a resource Outlook queries the public free busy object for that mailbox to determine if Direct Booking is enabled. So basically what you can do in a script is to walk the objects in the public free busy folder and check for these properties on each of the objects. If you read the documentation in the links I provided above you will see that Freebusy data is stored per Administrative Group in Exchange. The script I wrote uses CDO 1.2 to connect to a mailbox (its not really that important which mailbox as long as it is publishing freebusy data). In then uses the PR_FREEBUSY_ENTRYIDS 0x36E41102 mapi property which is a multivalued binary property stored in the root of a mailbox that holds the EntryID’s of various freebusy objects for that mailbox. The second ID in the prop holds the EntryID for the local freebusy object the third holds the EntryID for the public freebusy object for this mailbox. I’ve made use of this third one by using it to connect to the public freebusy object of the mailbox the script is connecting to and then just moving up to the parent folder object which will give the script the ability to walk all the objects in the public freebusy folder by using the message collection of this parent folder. To finish with the script generates a small html report called DOBreport.htm is c:\temp with a list of what mailboxes have direct booking enabled and what resource scheduling options have been selected. If you have multiple Administrative groups in your Exchange Organization you will need to connect to a mailbox in each exchange admin group to cover all mailboxes. Before running the script you need to configure the following two variables with the servername and mailbox of a mailbox to use.

MailServer = "servername"
Mailbox = "mailbox"

I’ve put a downloadable copy of the script here the script itself look like

MailServer = "mailbox"
Mailbox = "user"
Const PR_PARENT_ENTRYID = &H0E090102
Const PR_FREEBUSY_DATA = &H686C0102
report = "<table border=""1"" width=""100%"">" & vbcrlf
report = report & " <tr>" & vbcrlf
report = report & "<td align=""center"" bgcolor=""#000080""><b><font color=""#FFFFFF"">Mailbox-Name</font></b></td>"
& vbcrlf
report = report & "<td align=""center"" bgcolor=""#000080""><b><font color=""#FFFFFF"">Auto
Process Meetings</font></b></td>" & vbcrlf
report = report & "<td align=""center"" bgcolor=""#000080""><b><font color=""#FFFFFF"">Auto
Decline conflicts</font></b></td>" & vbcrlf
report = report & "<td align=""center"" bgcolor=""#000080""><b><font color=""#FFFFFF"">Auto
Decline recurring</font></b></td>" & vbcrlf
report = report & "</tr>" & vbcrlf

set objSession = CreateObject("MAPI.Session")
strProfile = MailServer & vbLf & Mailbox
objSession.Logon "",,, False,, True, strProfile
Set objInfoStores = objSession.InfoStores
set objInfoStore = objSession.GetInfoStore
Set objpubstore = objSession.InfoStores("Public Folders")
Set objRoot = objInfoStore.RootFolder

set non_ipm_rootfolder =
fbids = non_ipm_rootfolder.fields.item(PR_FREEBUSY_ENTRYIDS).value
set publicfbusy = objSession.getmessage(fbids(2),
set publicfbusyfold =
on error resume next
for each fbmess in publicfbusyfold.messages
wscript.echo fbmess.subject
wscript.echo "Automatically accept meeting and process cancellations : " &
wscript.echo "Automatically decline conflicting meeting requests : " &
wscript.echo "Automatically decline recurring meeting requests : " &
if err.number <> 0 then
if fbmess.fields.item(&H686D000B).value = true then
report = report & "<tr>" & vbcrlf
report = report & "<td align=""center"">" & fbmess.subject & "&nbsp;</td>" &
report = report & "<td align=""center"">" & fbmess.fields.item(&H686D000B) &
"&nbsp;</td>" & vbcrlf
report = report & "<td align=""center"">" & fbmess.fields.item(&H686F000B) &
"&nbsp;</td>" & vbcrlf
report = report & "<td align=""center"">" & fbmess.fields.item(&H686E000B) &
"&nbsp;</td>" & vbcrlf
report = report & "</tr>" & vbcrlf
end if
end if
report = report & "</table>" & vbcrlf
Set fso = CreateObject("Scripting.FileSystemObject")
set wfile = fso.opentextfile("c:\temp\DOBreport.htm",2,true)
wfile.write report
set wfile = nothing
set fso = nothing


Anonymous said...

Thanks for sharing the code.
I am trying your method and get vbscriptin error number 451 - Object is not a collection at line "ffbids = non_ipm_rootfolder.fields.item(PR_FREEBUSY_ENTRYIDS).value"
Any suggestion?
Thanks in advance for your response.

Glen said...

The one thing to be carefull of with this script is make sure you have no other Mapi connection open. So make sure Outlook is shut

Glen said...

One other thing is you need to make sure you use a mailbox that has published FreeBusy information. Eg if you use an account that has never been logged into via Outlook and has never create a freebusy objec then the script wont work.

Anonymous said...

Awesome! This is a great help for our DST woes. Thanks so much!!

Anonymous said...

On my system this spit out all the mailboxes, not just the ones that had Auto Process Meeting Requests turned on.

I changed the If Then to a Select Case and it worked. I also changed the output to a text file and put tabs between the fields so that I could open it with Excel for easy sorting.

Select Case fbmess.fields.item(&H686D000B).value
Case "True"
report = report & fbmess.subject & vbTab
report = report & fbmess.fields.item(&H686D000B) & vbTab
report = report & fbmess.fields.item(&H686F000B) & vbTab
report = report & fbmess.fields.item(&H686E000B) & vbTab
report = report & vbcrlf
End Select

Anonymous said...


I get the following error when attempting to run it: "Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]. I'm running it from an XP SP2 workstation with Office 2007, but Outlook is closed.

Glen said...

Are you using Exchange 2007 ? Do you have a Public FreeBusy folder in 2007 this isn't mandatory so in a pure Ex2007 without public folder this script wouldn't work you would need to query the availblity web service instead.


Anonymous said...

Have you explored at all modifying this script to turn off direct booking. This would be useful to the community for migrating mailboxes to E2007 as Direct Booking needs to be off prior to becoming a resource mailbox, and if you are dealing with lots of conf rooms, manually turning direct booking off drags.

Glen said...

Have a look at this may help


Ali Beeai said...

Guys I'm not a VB script person and I need some help... I am getting the following error message when trying to run the script from a windows server 2003 R2 SP2 with CDO 1.2.1 installed and no outlook client:

C:\showdbm.vbs(25, 1) Collaboration Data Objects: [Collaboration Data Objects -

any ideas?