Dịch vụ di chuyển nhóm SDK dành cho quản trị viên
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.
Dịch vụ Di chuyển nhóm của Admin SDK cho phép bạn sử dụng Groups Migration API của Admin SDK trong Apps Script. API này cho phép quản trị viên của các miền Google Workspace (kể cả người bán lại) di chuyển email từ các thư mục công khai và danh sách phân phối sang kho lưu trữ thảo luận của Google Groups.
Tài liệu tham khảo
Để biết thông tin chi tiết về dịch vụ này, hãy xem tài liệu tham khảo cho Groups Migration API của Admin SDK. Giống như tất cả các dịch vụ nâng cao trong Apps Script, dịch vụ Di chuyển nhóm của Admin SDK cũng sử dụng các đối tượng, phương thức và tham số giống như API công khai. Để biết thêm thông tin, hãy xem bài viết Cách xác định chữ ký phương thức.
Di chuyển email từ Gmail sang một Nhóm trên Google
Mẫu này lấy 3 thư có định dạng RFC 822 từ mỗi trong số 3 chuỗi mới nhất trong hộp thư đến Gmail của người dùng, tạo một blob từ nội dung email (bao gồm cả tệp đính kèm) và chèn blob đó vào một Nhóm Google trong miền.
/** * Gets three RFC822 formatted messages from the each of the latest three * threads in the user's Gmail inbox, creates a blob from the email content * (including attachments), and inserts it in a Google Group in the domain. */functionmigrateMessages(){// TODO (developer) - Replace groupId value with yoursconstgroupId='exampleGroup@example.com';constmessagesToMigrate=getRecentMessagesContent();for(constmessageContentofmessagesToMigrate){constcontentBlob=Utilities.newBlob(messageContent,'message/rfc822');AdminGroupsMigration.Archive.insert(groupId,contentBlob);}}/** * Gets a list of recent messages' content from the user's Gmail account. * By default, fetches 3 messages from the latest 3 threads. * * @return {Array} the messages' content. */functiongetRecentMessagesContent(){constNUM_THREADS=3;constNUM_MESSAGES=3;constthreads=GmailApp.getInboxThreads(0,NUM_THREADS);constmessages=GmailApp.getMessagesForThreads(threads);constmessagesContent=[];for(leti=0;i < messages.length;i++){for(letj=0;j < NUM_MESSAGES;j++){constmessage=messages[i][j];if(message){messagesContent.push(message.getRawContent());}}}returnmessagesContent;}
[[["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: 2025-10-14 UTC."],[],[]]