Служба миграции групп Admin SDK позволяет использовать API миграции групп Admin SDK в скрипте приложений. Этот API дает администраторам Google Workspace домены (включая реселлеров) возможность переносить электронную почту из общих папок и списков рассылки в архивы обсуждений групп Google.
Ссылка
Подробную информацию об этой услуге см. в справочной документации API миграции групп Admin SDK. Как и все расширенные службы в Apps Script, служба миграции групп Admin SDK использует те же объекты, методы и параметры, что и общедоступный API. Дополнительные сведения см. в разделе Как определяются сигнатуры методов .
В приведенном ниже примере кода используется версия 1 API.
Перенос электронной почты из Gmail в группу Google
Этот пример получает три сообщения в формате RFC 822 из каждой из трех последних цепочек в почтовом ящике Gmail пользователя, создает большой двоичный объект из содержимого электронного письма (включая вложения) и вставляет его в группу Google в домене.
/** * 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;}
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-01-09 UTC."],[[["The Admin SDK Groups Migration service enables administrators to migrate emails from public folders and distribution lists to Google Groups using Apps Script."],["This advanced service requires prior enabling in Google Workspace domains (including resellers) before use."],["Developers can leverage the Admin SDK Groups Migration API to programmatically manage email migration workflows."],["Sample code provided demonstrates how to migrate RFC 822 formatted emails from Gmail to a designated Google Group."],["Comprehensive documentation and support resources are available to guide developers in utilizing the service effectively."]]],[]]