1

I'm trying to create an Appointment with an Html Body containing a Hyperlink, like it is shown in this Example:

ewsAppointment = new EwsData.Appointment(service);
ewsAppointment.Subject = "Test";
var element = new XElement("html",
                    new XElement("body",
                        new XElement("p", 
                            new XElement("a", 
                                new XAttribute("href", "http://www.google.it/"), 
                                "google")), 
                        new XElement("p", "test 2"))));

ewsAppointment.Body.BodyType = EwsData.BodyType.HTML;
ewsAppointment.Body = element.ToString();
ewsAppointment.Save(SendInvitationsMode.SendToNone);

When i open this Appointment in Outlook 2010, the Body looks as expected:

Body in Outlook 2010

But in Outlook 2013, the formatting of the Body is lost and it looks like this:

Body in Outlook 2013

Any idea how i can fix this Problem?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Volkmar Rigo
  • 1,158
  • 18
  • 32

2 Answers2

0

The MS-OXCAL (section 2.2.1.38) standard document seems to suggest that appointments need to be specified in Rich Text Format. You might want to try writing the body in that, perhaps using a library like .NET RTF Writer.

I think the reason you're getting a weird change is because something in the chain is converting your HTML to RTF. This question has a lot more detail.

Matthew Sainsbury
  • 1,470
  • 3
  • 18
  • 42
  • That question was more concerned with the inner workings of Exchange when updating a Meeting message body. This seems to be a bit different. Exchange is supposed to accept plain text, HTML, or RTF for an Appointment/Meeting body, but has some issues with the serverside RTF conversion. It should still be entirely possible to set HTML and have it render properly in any version of Outlook, at least on creation. – user1017413 Nov 10 '15 at 20:32
  • The possible BodyTypes when using the "EWS manged API" are "Text" or "HTML". So it looks like i can not specify a RTF Text as body. – Volkmar Rigo Nov 16 '15 at 11:32
  • Sort of. It's not baked into the API, but it can be set as an extended property. – user1017413 Nov 16 '15 at 16:10
  • Do you have an example for setting the Text as RTF using the EWS Managed API? It's not an good solution but maybe a way to get it to work... – Volkmar Rigo Nov 17 '15 at 09:25
0

The property PR_RTF_COMPRESSED is what you need. It is MAPI property supported as extended property in EWS Managed API and Exchange Web Services .NET