EWS API: Remove attendee and set "SendOnlyToChanged" sends update to everyone

1.1k views Asked by At

I try to remove an attendee programmatically from an appointment and update it with the option SendOnlyToChanged. The problem is all attendees also receiving an email with an update about the meeting, and not only the changed.

appointmentOutlook.update( ConflictResolutionMode.AlwaysOverwrite,SendInvitationsOrCancellationsMode.SendOnlyToChanged );

I found the same question here on exchange server forum, but also without success.

Did anybody found a solution or workaround for this issue?

2

There are 2 answers

1
Jan Doggen On

The trick is to use ConflictResolutionMode.AutoResolve.

Don't ask me why it works this way, it was in an answer to a more recent question then yours.

(So I won't mark either answer as duplicate, but just refer to it).

0
Sami On

Here is example with API from Independentsoft. Administrator sends meeting request to Mark, John and Peter and decided to remove John from meeting.

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startTime = dateFormat.parse("2013-01-03 18:00:00");
Date endTime = dateFormat.parse("2013-01-03 19:00:00");

Appointment appointment = new Appointment();
appointment.setSubject("Test15");
appointment.setBody(new Body("Body text."));
appointment.setStartTime(startTime);
appointment.setEndTime(endTime);
appointment.setLocation("Room 123");
appointment.setReminderIsSet(true);
appointment.setReminderMinutesBeforeStart(30);
appointment.getRequiredAttendees().add(new Attendee("[email protected]"));          
appointment.getRequiredAttendees().add(new Attendee("[email protected]"));
appointment.getRequiredAttendees().add(new Attendee("[email protected]"));

ItemId itemId = service.sendMeetingRequest(appointment);

//add first
ItemChange itemChange1 = new ItemChange(itemId);
itemChange1.getPropertiesToSet().add(new Property(AppointmentPropertyPath.REQUIRED_ATTENDEES, new Attendee("[email protected]")));

itemId = service.updateItem(itemChange1, SendMeetingOption.SEND_TO_CHANGED_AND_SAVE_COPY);

{ //add others non-removed in a loop

    ItemChange itemChange2 = new ItemChange(itemId);
    itemChange2.getPropertiesToAppend().add(new Property(AppointmentPropertyPath.REQUIRED_ATTENDEES, new Attendee("[email protected]")));

    itemId = service.updateItem(itemChange2, SendMeetingOption.SEND_TO_CHANGED_AND_SAVE_COPY);
}