Exchange & Outlook Custom Form Room Reservations; Retain Invitations

As I mentioned in my article Exchange & Outlook Custom Room Reservations, Guide & Template , the trouble with using custom forms for room reservations in Microsoft Exchange is that you have to retrain your users to open the room’s calendar directly. This is because the default room invitation process never displays a form at all. It only shows an EWS (Exchange Web Service) generated list of available rooms and their free / busy information. When the user selects one, the room’s mailbox is sent an invitation email which is processed by the attendant service or the room’s moderator. The reserver never gets a chance to see your custom form or complete any of the extra data fields you’ve painstakingly created.

Re-training your employees to open the room’s calendar isn’t too difficult if you’re setting up the service for a small organization. If you work for a company with hundreds or thousands of employees you’ll likely end up frustrated and so will your users. There are quite a few 3rd party add-ons for Exchange that claim to fix this limitation. You don’t need them. In this article we’ll explore using a few lines of HTML, JavaScript, PowerShell, and Outlook to allow the normal invitation process, while still compelling your users to complete the custom form.

My solution involves 4 basic components that, when executed correctly, allows the room’s mailbox to send an email back to the user requesting they complete your custom form. The auto response message will include a link that directly opens the room’s calendar showing their appointment. We’ll use PowerShell to alter the appointments created by the invitation so that they use our custom form.

  • Enable automated processing for the room invitations
  • Alter the message class of the tentative appointments
  • Create web pages that open each room
  • Create an invitation auto response with a link to the web pages

Enable Invitation Auto-update

In order for my technique to work, the room’s invitation must be processed from an email to a tentative appointment before the user receives the automated response. To accommodate this requirement we need to tell Exchange to automatically update the invitation on receipt (it can wait for hours otherwise).

  1. Create a txt file that contains only your room’s (assuming more than one) email addresses (you can see them in the EMC).
  2. Open the Exchange Management Shell or import an Exchange session in to your PowerShell.
  3. Run the following script (change the path to match the location of your text file)
    $ccrooms = Get-Content -path "C:\Users\MyUserName\Documents\ccroom.txt"
    Foreach ($ccroom in $ccrooms) {Set-CalendarProcessing -identity $ccroom -AutomateProcessing Autoupdate}
    
  4. If you ever add more rooms you’ll need to update them as well.

Alter the Message Class of the tentative appointments

Which form Exchange uses to open a message is determined by an attribute stored in Active Directory called the message class; it gets added when you alter the schema for the installation of Exchange. We want to alter all of the room’s tentative appointments so that they use our custom form. For this to work you’ll need to set up a few things ahead of time.

  1. A machine with Outlook installed (I use a VM). You could also use CDO on an Exchange 2013 or older server but you will need to alter the COM object in the script.
    • I haven’t been succesful in changing the attribute via EWS. You can set the default message class for a mailbox but not for each individual appointment; which is what we need for this solution to work.  If you know how to do this in EWS leave a comment, I’d really appreciate it.
  2. The AD account you logon to the machine with must have full permissions to all the room’s mailboxes.
  3. Create an Outlook profile for each room’s mailbox on the machine (individually); you probably think that you know better and can just open the mailboxes from one profile but you don’t / can’t. Just trust me.

Now that you have everything staged, we’re going to execute a PowerShell script that runs in a loop every 30 seconds and changes all the appointment’s message class attributes to our custom form.

Here’s the code:

Function Change-Class
{
$mbxs = Get-Content -path "C:\Users\Myusername\Documents\ccroom.txt"
Foreach ($ccroom in $ccrooms)
{
$outlook = new-object -com Outlook.Application
$namespace = $outlook.GetNamespace("MAPI")
$room = $namespace.CreateRecipient("$ccroom")
$room.Resolve()
$roomcal = $outlook.Session.GetSharedDefaultFolder($room, 9)
$appointments = $roomcal.items

Foreach ($appointment in $appointments)
   {
     If ($appointment.messageclass -eq "IPM.Appointment")
     {
      $appointment.messageclass = "IPM.Appointment.Conference Center"
      $appointment.save()
     }
   }
}
}
While ($true)
{
Change-Class
Sleep -Seconds 30
}

Notice that we’re using the same list of the room’s email addresses; don’t forget to change the path to match the location you’ve stored the file in. You’ll also need to alter the name of the form on the line $appointment.messageclass = “IPM.Appointment.Conference Center” to match the name of your published custom form. You must publish your form to each room with the same name or alter the script accordingly.

Create Web Pages that Open each room from a hyperlink

We’ll setup an auto responce to room invites in the next step. We’ll want to include a hyperlink in that auto-responce that opens the room’s calendar in Outlook for the user. This makes the process appear more seamless. You could accomplish this same goal in other ways, but I found this approach to be effective and simple.

You’ll need an IIS instance to host the pages on. Since we’re talking about Exchange you’ll have OWA and EWS installed, the IIS instance that hosts those services will do just fine here. Just create a new file based site and place the pages you create into the folder. I’m not including full instructions for this, but if you get stuck leave a comment.

ConferenceCenterRoomLinkPages

Now we need to create one page for each room. You be using the email address of the room to identify it. Paste the code below (change the email address) into notepad and save it with the HTML extension.

<!DOCTYPE html>
<html>
<head>

function OpenConferenceCenter()
{
var outlookApp = new ActiveXObject(‘Outlook.Application’);
var pmapi = outlookApp.getNameSpace(“MAPI”);
var recipient = pmapi.CreateRecipient(“room@mydomain.com”);
recipient.Resolve();
var calendar = pmapi.GetSharedDefaultFolder(recipient, 9)
calendar.display ()
}

</head>
<body onload =”OpenConferenceCenter ()” ;>
</body>
</html>

As you can see, we are creating an Active X object in the web pages to open Outlook and then the room’s calendar, which means this only works in Internet Explorer.

Create an invitation auto response with a link to the web pages

Now is when those Outlook profiles we setup earlier will come into play. We want to use Outlook to create a rule to repsond to calendar inviations in each room’s mailbox. This rule is not visible in Outlook for shared mailboxes, hence the profiles.

For each room:

  • Open the Room’s mailbox in an Outlook profile
  • Click on the Rules button in the ribbon and then select Manage Rules and Alerts.
  • Click the New Rule button
  • Select Apply rule on messages I receive
  • Check which is a meeting invitation or update
  • Click Next
  • Check; Have the server reply using a specific message.
  • In the bottom pane click underlined words “a specific message” and enter your message. I reccomend something like the text below(change the hyperlink location).

Your tentative reservation request has been received. Approval of your reservation request is based on receipt of the meeting information form. Please use the link below to locate your appointment, open it, and complete the Conference Center form by clicking its icon in the Ribbon.

CustomFormButton

The web link below only works in Internet Explorer. If your default browser is set to something else, you’ll need to right click and copy the they hyperlink below. Then paste it into Internet Explorer.

Click here to open the room’s calendar and adjust your appointment.

  • Click Save and Close on the Message
  • Finish the Rule

You should be ready to test now. If everything has gone according to plan the user’s experience should go like this:

  1. The meeting’s organizer selects a room from the default appointment form in the Outlook.
  2. Once they submit the invitation the room’s mailbox will reply with our message to finish the form.
  3. When the click the link embedded in the message the room’s calendar will open, they should double-click the appointment they just made to open it.
  4. All that is left is to click the form’s button to display it, complete it and save it.

This seems complicated but I’ve implemented it in an environment with 15,000 + users without any training and encountered very few issues. If you end up using this method in your own business I’d appreciate you leaving a comment.

2 Comments

    1. You would need to replace the ActiveX control in the web page that opens the room calendar in the user’s Outlook with something that can run in non IE browsers. HTML5 , JAVASCRIPT, or something like that.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s