ews-java-api icon indicating copy to clipboard operation
ews-java-api copied to clipboard

cannot add attachments for appointment

Open iwang opened this issue 12 years ago • 3 comments

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.

iwang avatar Oct 28 '14 09:10 iwang

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

iwang avatar Oct 29 '14 07:10 iwang

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 ?

pheenomenon avatar Jul 18 '15 04:07 pheenomenon

Hi @vboctor any proposed date for this fix, or do you have some thoughts on how this can be fixed.

vnitin avatar Oct 26 '15 05:10 vnitin