Microsoft graph sdks 使用Microsoft Graph Java SDK的大型(>;4mb)文件附件

Microsoft graph sdks 使用Microsoft Graph Java SDK的大型(>;4mb)文件附件,microsoft-graph-sdks,microsoft-graph-calendar,Microsoft Graph Sdks,Microsoft Graph Calendar,如果附件大小超过4 MB,如何使用JAVA将附件添加到现有会议日历事件id使用JAVA库: 使用java库: GraphService client = ... File file = new File("example.txt"); AttachmentItem attachmentItem = AttachmentItem .builder() .attachmentType(AttachmentType.FILE) .contentType("te

如果附件大小超过4 MB,如何使用JAVA将附件添加到现有会议日历事件id使用JAVA库:

使用java库:

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);