Class FolderIterator
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
FolderIterator
Một đối tượng cho phép tập lệnh lặp lại trên một tập hợp thư mục có thể lớn. Bạn có thể truy cập vào trình lặp thư mục từ DriveApp, File hoặc Folder.
// Log the name of every folder in the user's Drive.constfolders=DriveApp.getFolders();while(folders.hasNext()){constfolder=folders.next();Logger.log(folder.getName());}
Lấy mục tiếp theo trong bộ sưu tập tệp hoặc thư mục.
Tài liệu chi tiết
getContinuationToken()
Lấy một mã thông báo có thể dùng để tiếp tục vòng lặp này vào lúc khác. Phương thức này hữu ích nếu việc xử lý một trình lặp trong một lần thực thi vượt quá thời gian thực thi tối đa. Mã thông báo tiếp tục thường có hiệu lực trong một tuần.
Cầu thủ trả bóng
String – Mã thông báo tiếp tục có thể dùng để tiếp tục lần lặp này với những mục còn lại trong trình lặp khi mã thông báo được tạo.
hasNext()
Xác định xem việc gọi next() có trả về một mục hay không.
Cầu thủ trả bóng
Boolean – true nếu next() trả về một mục; false nếu không.
next()
Lấy mục tiếp theo trong bộ sưu tập tệp hoặc thư mục. Gửi một trường hợp ngoại lệ nếu không còn mục nào.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2026-03-06 UTC."],[],["FolderIterator allows iterating over a large collection of folders. Key actions include using `hasNext()` to check for the next item and `next()` to retrieve it. `getContinuationToken()` provides a token to resume iteration later, helpful for large collections. The example shows how to log every folder's name in a user's Drive, demonstrating iteration through the folder collection. The iterator returns folder objects and can throw an exception if no items remain.\n"]]