/** Lists notes using different filtering and pagination options. */privatevoidlistNotes()throwsIOException{// Lists 3 notes that were created after a specified timestamp and that are not trashed. Results// are ordered by most recently modified first.ListNotesResponseresponse=keepService.notes().list().setFilter("create_time > \"2021-01-01T00:00:00Z\"").setFilter("-trashed").setPageSize(3).execute();System.out.println("List notes response: "+response);// Lists notes using a pagination token.ListNotesResponsefirstPageResponse=keepService.notes().list().setPageSize(1).execute();StringnextPageToken=firstPageResponse.getNextPageToken();for(inti=0;i < 5;i++){// Uses the page token that was returned by the previous page's next page token.ListNotesResponsepagedResponse=keepService.notes().list().setPageSize(1).setPageToken(nextPageToken).execute();System.out.println("Listing note:"+pagedResponse);nextPageToken=pagedResponse.getNextPageToken();}}
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/12/21 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2024/12/21 (UTC)."],[[["This code sample demonstrates how to retrieve a list of notes from Google Keep using the `notes.list()` method in REST and Java."],["The Java example shows how to filter notes based on creation time and trash status, limiting results to 3 and ordering them by modification time."],["It also illustrates using pagination to retrieve notes in batches of 1, iterating through 5 pages by leveraging the `nextPageToken` for continuous retrieval."]]],[]]