这是 Independentsoft 的 API 示例。管理员向 Mark、John 和 Peter 发送会议请求,并决定将 John 从会议中删除。
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("Mark@mydomain3.com"));
appointment.getRequiredAttendees().add(new Attendee("John@mydomain3.com"));
appointment.getRequiredAttendees().add(new Attendee("Peter@mydomain3.com"));
ItemId itemId = service.sendMeetingRequest(appointment);
//add first
ItemChange itemChange1 = new ItemChange(itemId);
itemChange1.getPropertiesToSet().add(new Property(AppointmentPropertyPath.REQUIRED_ATTENDEES, new Attendee("Mark@mydomain3.com")));
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("Peter@mydomain3.com")));
itemId = service.updateItem(itemChange2, SendMeetingOption.SEND_TO_CHANGED_AND_SAVE_COPY);
}