1

How to add attachments to the existing meeting calendar event id if the attachment size is more than 4 MB using JAVA

1 Answers1

0

Use the java library odata-client-msgraph:

GraphService client = ...
File file = new File("example.txt");
AttachmentItem attachmentItem = AttachmentItem
  .builder()
  .attachmentType(AttachmentType.FILE)
  .contentType("text/plain")
  .name("example.txt")
  .size(file.length())
  .build();
int chunkSize = 512 * 1024;
client
  .user("USERID")
  .calendars()
  .events("EVENTID")
  .attachments()
  .createUploadSession(attachmentItem)
  .get()
  .putChunked()
  .readTimeout(10, TimeUnit.MINUTES)
  .upload(file, chunkSize);
Dave Moten
  • 11,957
  • 2
  • 40
  • 47