Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating an Appointment causes it to change to a Meeting in EWS 1.1

Here's what I'm trying to do:

  • get all items on a user's calendar between two dates
  • update the Location or Subject for some items

I get the items with:

FindItemsResults<Appointment> findResults = calendar.FindAppointments(new CalendarView(startDate, endDate));

This query works fine. But whenever I call Update to save the item I get an exception:

Microsoft.Exchange.WebServices.Data.ServiceResponseException: One or more recipients are invalid.

Even though I get an exception, the item is saved and gets changed to have IsMeeting set to true! Now the updated item is a meeting with an organizer etc... This is, effectively, data corruption for me.

Here's the code. It is no more complicated than this. I've tested it by just changing Location or Subject and both cause the problem.

Appointment a = Appointment.Bind(_service, new ItemId(id));
a.Location = newLocation
a.Update(ConflictResolutionMode.AlwaysOverwrite);

Am I missing some concept or something? This seems like a pretty egregious problem.

FWIW, this is EWS 1.1 against an Office 365 server.

like image 459
tig Avatar asked Nov 25 '11 23:11

tig


1 Answers

I figured it out with help from this Question:

Exchange Appointment Types

The key is the Update method needs to be called with the SendInvitationsOrCancellationsMode.SendToNone flag set in the 2nd parameter.

Like this:

a.Update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToNone);
like image 89
tig Avatar answered Oct 01 '22 00:10

tig