Mengambil catatan dan lampiran

Contoh berikut menunjukkan cara mengambil catatan dan lampirannya:


Panggil dengan nama download lampiran dan parameter URL alt=media. Parameter URL alt=media memberi tahu server bahwa download konten sedang diminta.

Untuk mendapatkan nama lampiran, Anda harus mengambil catatan terlebih dahulu.


 * 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 =

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