Skip to main content

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_FREEBUSY_ENTRYIDS = &H36E41102
Const PR_PARENT_ENTRYID = &H0E090102
Const PR_RECALCULATE_FREEBUSY = &H10F2000B
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 =
objSession.getfolder(objroot.fields.item(PR_PARENT_ENTRYID),objInfoStore.id)
fbids = non_ipm_rootfolder.fields.item(PR_FREEBUSY_ENTRYIDS).value
set publicfbusy = objSession.getmessage(fbids(2),objpubstore.id)
set publicfbusyfold =
objSession.getfolder(publicfbusy.fields.item(PR_PARENT_ENTRYID),objpubstore.id)
on error resume next
for each fbmess in publicfbusyfold.messages
wscript.echo fbmess.subject
wscript.echo "Automatically accept meeting and process cancellations : " &
fbmess.fields.item(&H686D000B)
wscript.echo "Automatically decline conflicting meeting requests : " &
fbmess.fields.item(&H686F000B)
wscript.echo "Automatically decline recurring meeting requests : " &
fbmess.fields.item(&H686E000B)
wscript.echo
if err.number <> 0 then
err.clear
else
if fbmess.fields.item(&H686D000B).value = true then
report = report & "<tr>" & vbcrlf
report = report & "<td align=""center"">" & fbmess.subject & "&nbsp;</td>" &
vbcrlf
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
next
report = report & "</table>" & vbcrlf
Set fso = CreateObject("Scripting.FileSystemObject")
set wfile = fso.opentextfile("c:\temp\DOBreport.htm",2,true)
wfile.write report
wfile.close
set wfile = nothing
set fso = nothing

Popular posts from this blog

The MailboxConcurrency limit and using Batching in the Microsoft Graph API

If your getting an error such as Application is over its MailboxConcurrency limit while using the Microsoft Graph API this post may help you understand why. Background   The Mailbox  concurrency limit when your using the Graph API is 4 as per https://docs.microsoft.com/en-us/graph/throttling#outlook-service-limits . This is evaluated for each app ID and mailbox combination so this means you can have different apps running under the same credentials and the poor behavior of one won't cause the other to be throttled. If you compared that to EWS you could have up to 27 concurrent connections but they are shared across all apps on a first come first served basis. Batching Batching in the Graph API is a way of combining multiple requests into a single HTTP request. Batching in the Exchange Mail API's EWS and MAPI has been around for a long time and its common, for email Apps to process large numbers of smaller items for a variety of reasons.  Batching in the Graph is limited to a m

Sending a Message in Exchange Online via REST from an Arduino MKR1000

This is part 2 of my MKR1000 article, in this previous post  I looked at sending a Message via EWS using Basic Authentication.  In this Post I'll look at using the new Outlook REST API  which requires using OAuth authentication to get an Access Token. The prerequisites for this sketch are the same as in the other post with the addition of the ArduinoJson library  https://github.com/bblanchon/ArduinoJson  which is used to parse the Authentication Results to extract the Access Token. Also the SSL certificates for the login.windows.net  and outlook.office365.com need to be uploaded to the devices using the wifi101 Firmware updater. To use Token Authentication you need to register an Application in Azure https://msdn.microsoft.com/en-us/office/office365/howto/add-common-consent-manually  with the Mail.Send permission. The application should be a Native Client app that use the Out of Band Callback urn:ietf:wg:oauth:2.0:oob. You need to authorize it in you tenant (eg build a small ap

How to test SMTP using Opportunistic TLS with Powershell and grab the public certificate a SMTP server is using

Most email services these day employ Opportunistic TLS when trying to send Messages which means that wherever possible the Messages will be encrypted rather then the plain text legacy of SMTP.  This method was defined in RFC 3207 "SMTP Service Extension for Secure SMTP over Transport Layer Security" and  there's a quite a good explanation of Opportunistic TLS on Wikipedia  https://en.wikipedia.org/wiki/Opportunistic_TLS .  This is used for both Server to Server (eg MTA to MTA) and Client to server (Eg a Message client like Outlook which acts as a MSA) the later being generally Authenticated. Basically it allows you to have a normal plain text SMTP conversation that is then upgraded to TLS using the STARTTLS verb. Not all servers will support this verb so if its not supported then a message is just sent as Plain text. TLS relies on PKI certificates and the administrative issue s that come around certificate management like expired certificates which is why I wrote th
All sample scripts and source code is provided by for illustrative purposes only. All examples are untested in different environments and therefore, I cannot guarantee or imply reliability, serviceability, or function of these programs.

All code contained herein is provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.