OfficeDev / ews-managed-api

Other
584 stars 317 forks source link

How can I created an Appointment through EWS with a compressed RTF body? #127

Open kharabasz opened 7 years ago

kharabasz commented 7 years ago

I would like to create an Appointment through EWS with a compressed RTF body instead of the default HTML format due to several bugs w/ Exchange around HTML formatted appointment bodies.

The code I am using looks similar to that below:

var appointment = new Appointment(exchangeService);
...
string html = // html body
string compressedRtf = // converted using Microsoft.Exchange.Data.TextConverters
...
var epd = new ExtendedPropertyDefinition(0x1009, MapiPropertyType.Binary);
appointment.SetExtendedProperty(epd, 
    System.Text.Encoding.Unicode.GetBytes(compressedRtf));
...
appointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);

This throws a "Content conversion failed." exception when Saved. Is there anything glaringly wrong here? I have not been able to find documentation or code samples, just a few hints that I may need to set additional Extended Properties to get this to work.