/**
* Gets and downloads the attachment of a note.
*
* @param note The note whose attachment will be downloaded.
* @throws IOException
*/
private void getNoteAttachment(Note note) throws IOException {
// First call is to get the attachment resources on the note.
List<Attachment> attachments =
keepService.notes().get(note.getName()).execute().getAttachments();
if (!attachments.isEmpty()) {
Attachment attachment = attachments.get(0);
String mimeType = attachment.getMimeType().get(0);
// A second call is required in order to download the attachment with the specified mimeType.
OutputStream outputStream = new FileOutputStream("attachmentFile." + mimeType.split("/")[1]);
keepService
.media()
.download(attachment.getName())
.setMimeType(mimeType)
.executeMediaAndDownloadTo(outputStream);
}
}
تاریخ آخرین بهروزرسانی 2024-12-01 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2024-12-01 بهوقت ساعت هماهنگ جهانی."],[],[]]