Hide
Apps Script

Class Token

Token

Deprecated. The DocsList service was deprecated on December 11, 2014. To work with files in Google Drive, use the Drive service instead.

A token object used to enable pagination in methods that return a limited number of items. For example, the token can be passed to sequential DocsList.getAllFilesForPaging(number, token) calls to continue paging through large sets of results.

 

 // This example logs the names of all files in the user's drive in batches of 200
 var pageSize = 200;
 var files = null;
 var token = null;
 do {
   var result = DocsList.getAllFilesForPaging(pageSize, token);
   files = result.getFiles();
   token = result.getToken();
   for (var i = 0; i < files.length; i++) {
     Logger.log(files[i].getName());
   }
 } while (files.length >= pageSize);