cannot add attachments for appointment
I tried to add a attachment with below code, the appointment is saved without attachments.
Appointment appointment = new Appointment(service);
appointment.setSubject("This is a subject");
appointment.setBody(MessageBody.getMessageBodyFromText("test"));
appointment.getRequiredAttendees().add("DEV1", "dev@**..com");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startDate = formatter.parse("2014-11-09 18:00:00");
Date endDate = formatter.parse("2014-11-09 19:00:00");
appointment.setStart(startDate);
appointment.setEnd(endDate);
FileAttachment attachment = appointment.getAttachments().addFileAttachment("C:/Users/ivan.wang/Downloads/new.txt");
attachment.setIsInline(false);
appointment.save();
Then I found this, and append below code after saving the appointment.
appointment.setSubject("abcd");
appointment.update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);
By changing the subject, it will force an update and the attachment is saved successfully. However, you can see a cancelled calendar at the bottom, so it's not a solution for product use.
Is this a bug with EWS itself, do you have any better workaround.
Never mind, I figured it out.. First saving without attendees then making an update by adding attendees solves this.
I also listed other issues I ran into when using ews java api, hopefully someone needs it. http://iwang.github.io/work/2014/10/29/ews-issue-collected.html
Hello @iwang I am running into the same issue. I did appointment.save(); and then added attendees as you suggested appointment.update(ConflictResolutionMode.AlwaysOverwrite, SendInvitationsOrCancellationsMode.SendToAllAndSaveCopy);
However I am still unable to get the attachments to show up in the invite. Do you know what parameters to pass to save() or update() to get this to work ?
Hi @vboctor any proposed date for this fix, or do you have some thoughts on how this can be fixed.