问题
EWS creates appointment with a default "When" text in the body. Please see the image below:
I am wondering if it is possible to remove or hide this text some how.
Here is my code which create appointment using EWS Managed API
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
service.Credentials = new WebCredentials("ews_calendar", PASSWORD, "acme");
service.Url = new Uri("https://acme.com/EWS/Exchange.asmx");
Appointment newAppointment = new Appointment(service);
newAppointment.Subject = "Test Subject";
newAppointment.Body = "Test Body";
newAppointment.Start = new DateTime(2012, 07, 19, 17, 00, 0);
newAppointment.End = newAppointment.Start.AddMinutes(30);
newAppointment.RequiredAttendees.Add("first.last@acme.com");
// create new appointment
newAppointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
回答1:
I created test appointments using EWS in the same manor above and explored the properties of the objects using MFCMAPI and EWS Editor. Via MAPI the when-text is stored in the PidTagHtml
property. Via EWS the when-text is stored in the Body
property. The when-text exists on the received copy, but not on the original in the sender's calendar folder.
Based on this it appears the when-text is inserted to the body at send time. If you remove the line
newAppointment.RequiredAttendees.Add("first.last@acme.com");
then an appointment is created instead of a meeting. In that case the when-text doesn't come into play.
- I'm pretty sure there's no way to get around this behavior, except for going into the recipient's mailbox and removing the text on the received copy.
- Even if there was a better workaround, I wouldn't recommend doing it because both Outlook and OWA create meetings in the same manor.
来源:https://stackoverflow.com/questions/11568699/removing-ews-appointment-body-text