while send email using office365, below code is added for to get searchkey to get thread id in future use (if thread id not generated), this code gives error - "The send or update operation could not be performed because the change key passed in the request does not match the current change key for the item", if I attach bigger file in size more than 3 MB.
FileAttachment fileAttachment = new FileAttachment( "C:\\send_files\\100 Percent
Automated Support - NCUCCC.pdf" );// 4.6MB file attached
AttachmentId attachmentId = service.createAttachment( fileAttachment, messageId );
messageId.setChangeKey( attachmentId.getRootItemChangeKey() );
FileAttachment fileAttachment1 = new FileAttachment( "C:\\send_files\\getting-started-with-hadoop-planning-guide.pdf" );// 3.1MB file attached
AttachmentId attachmentId1 = service.createAttachment( fileAttachment1, messageId );
messageId.setChangeKey( attachmentId1.getRootItemChangeKey() );
messageFromDrafts = service.getMessage( messageId );
searchKey = messageFromDrafts.getSearchKey();
service.send( messageId );
below code works fine to send email with attachment of bigger size files. so better use this code to send email with attachment of bigger files.
ItemInfoResponse response = service.send( messageId );
below 3 MB file size as attachment is not giving any issue