Sending Appointments from EWS Apps: Where did my HTML go???

 

Update: As on 25th May 2012, Roll Up 3 for Exchange Server 2010 SP2 addresses this issue. You can install this update from: https://www.microsoft.com/en-us/download/details.aspx?id=29899

You can read a description of the issue here: https://support.microsoft.com/kb/2689810

_____________________________

Disclaimer: The contents of this article stand true at the time of writing it, which is on the 18th of May, 2012. The last release to Exchange Server 2010 at this point is Rollup 2 for Service Pack 2. Behavior is expected to change (for better) in subsequent updates.

 
So we’ve uncovered a rather peculiar issue existing in Exchange 2010 whereby if you use an Exchange Web Services application to generate and send out a meeting request whose body contains HTML formatting, you’ll observe that when you open the meeting item in Outlook, you might find that the HTML formatting of the text is missing. Interestingly, this behavior is observed when Outlook is running in Online Mode, though the content will be nice and HTML-formatted when Outlook is in Cached mode or you’re viewing it through Outlook Web Access.

Poof! Magic? Err… guess not.

This is due to a known issue that has been identified and fixed, and will in all probability be rolled out in a subsequent update to Exchange Server.

What we have done, though, is fixed this specific issue for Recurring items in Rollup 2 for Exchange 2010 Service Pack 2. So if you think this specific issue is going to cause a lot of controversy at your end, we have identified a possible work-around for you…

To implement this work-around:

  1. Have your organization’s Exchange Server 2010 patched to Service Pack 2 Rollup 2 (https://www.microsoft.com/en-us/download/details.aspx?id=29427)
  2. Alter the code in the EWS application that you’ve written so as to make the meeting item Recurring. Naturally, the question is “Why would I make it recurring if it’s going to take place only once?”
    The answer is that you’re going down that road because you need HTML formatted e-mails generated out of your Exchange Web Services application to be accurately viewable in Outlook clients running specifically in Online Mode, and it cannot wait till the issue is addressed in a subsequent rollup/service pack.
    Also, we don’t really need to create multiple recurrences of a meeting item which has to take place only once. We create once recurring instance, and trick Outlook into thinking that it’s a recurring series.

So while traditionally, your code would’ve looked like this…

Appointment appointment = new Appointment(service);
appointment.Subject = "Recurring with proper HTML";

appointment.Body = "<html><body><bold>Recurring Item</BOLD><br /><A href='https://www.bing.com'>Bing</a><p /><Font face='Arial' size=15>HTML formatted Body</font></body></html>";

appointment.Body.BodyType = BodyType.HTML;
appointment.Start = DateTime.Now.AddDays(1);
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "Conference Room";
appointment.RequiredAttendees.Add(“recipient@domain.com”);

appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

now it would have to read this…

Appointment appointment = new Appointment(service);
appointment.Subject = "Recurring with proper HTML";

appointment.Body = "<html><body><bold>Recurring Item</BOLD><br /><A href='https://www.bing.com'>Bing</a><p /><Font face='Arial' size=15>HTML formatted Body</font></body></html>";

appointment.Body.BodyType = BodyType.HTML;
appointment.Start = DateTime.Now.AddDays(1);
appointment.End = appointment.Start.AddHours(2);
appointment.Location = "Conference Room";
appointment.RequiredAttendees.Add("recipient@domain.com");

//Here, we pretend that it's recurring... Though the number of occurrences is just 1! appointment.Recurrence = new Recurrence.DailyPattern(appointment.Start, 1);
appointment.Recurrence.NumberOfOccurrences = 1;

appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

 

The only catch is that Outlook would be telling you that the meeting item is recurring, when it really isn’t. And that’s where you figure out which of the 2 options suits you better.

Cheers!