Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Invia feedback
Recuperare note e allegati
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Il seguente esempio mostra come recuperare una nota e il relativo allegato:
REST Chiama
media.download
con il nome del download dell'allegato e il parametro URL alt=media.
Il parametro URL alt=media indica al server che è stato richiesto il download dei contenuti.
Per ottenere il nome dell'allegato, devi prima recuperare la nota .
Nota: Il parametro URL alt=media è un
parametro di sistema
disponibile in tutte le API REST di Google. Se utilizzi una libreria client per l'API Google Keep, non devi impostare esplicitamente questo parametro.
Java
/**
* 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 );
// Make a second call 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 );
}
}
Invia feedback
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0 , mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0 . Per ulteriori dettagli, consulta le norme del sito di Google Developers . Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2026-05-13 UTC.
Vuoi dirci altro?
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2026-05-13 UTC."],[],[]]