if(!destination.exists()){ byte[] data = entry.getValue().getBody().getAttachmentId() != null ? gmailService.users().messages().attachments().get("me", message.getId(), entry.getValue().getBody().getAttachmentId()).execute().decodeData() : entry.getValue().getBody().decodeData(); Puzzle puzzle = singleFilename.endsWith("jpz") ?
/** * Gets the specified message attachment. * * Create a request for the method "attachments.get". * * This request holds the parameters needed by the gmail server. After setting any optional * parameters, call the {@link Get#execute()} method to invoke the remote operation. * * @param userId The user's email address. The special value me can be used to indicate the authenticated user. * [default: me] * @param messageId The ID of the message containing the attachment. * @param id The ID of the attachment. * @return the request */ public Get get(java.lang.String userId, java.lang.String messageId, java.lang.String id) throws java.io.IOException { Get result = new Get(userId, messageId, id); initialize(result); return result; }