11

EWS creates appointment with a default "When" text in the body. Please see the image below:

enter image description here

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);
Firoz Ansari
  • 2,505
  • 1
  • 23
  • 36
  • Would it work to change the body text afterwards as outlined in [this answer](http://stackoverflow.com/a/3326675/85950)? – blahdiblah Jul 27 '12 at 02:32
  • @blahdiblah That link is relating to read or update existing appointment. In above example, I am trying to create new appointment. Not sure why but EWS automatically prepend its own text before sending notification. – Firoz Ansari Jul 27 '12 at 12:41
  • Yeah, I realize it's not exactly what you're looking for, but thought that maybe it would be sufficient to change the appointment body text immediately after it's created. It is definitely weird that EWS adds its own text, what a pain. – blahdiblah Jul 27 '12 at 15:51

1 Answers1

2

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.

  1. 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.
  2. Even if there was a better workaround, I wouldn't recommend doing it because both Outlook and OWA create meetings in the same manor.
Elijah W. Gagne
  • 2,801
  • 4
  • 31
  • 29