简体   繁体   中英

EWS managed API - Appointment with Html Body and Outlook 2013

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:

Outlook 2010中的正文

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

Outlook 2013中的正文

Any idea how i can fix this Problem?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM