Admin SDK Groups Migration Service
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
سرویس Admin SDK Groups Migration به شما امکان می دهد از API انتقال گروه های Admin SDK در Apps Script استفاده کنید. این API به سرپرستان دامنههای Google Workspace (از جمله فروشندگان) این امکان را میدهد که ایمیلها را از پوشههای عمومی و فهرستهای توزیع به آرشیوهای بحث Google Groups منتقل کنند.
مرجع
برای اطلاعات دقیق درباره این سرویس، به مستندات مرجع Admin SDK Groups Migration API مراجعه کنید. مانند همه سرویسهای پیشرفته در Apps Script، سرویس Admin SDK Groups Migration از اشیاء، روشها و پارامترهای مشابه API عمومی استفاده میکند. برای اطلاعات بیشتر، نحوه تعیین امضای روش را ببینید.
برای گزارش مشکلات و یافتن سایر پشتیبانیها، راهنمای پشتیبانی انتقال گروههای SDK Admin را ببینید.
کد نمونه
کد نمونه زیر از نسخه 1 API استفاده می کند.
انتقال ایمیل از Gmail به یک گروه Google
این نمونه سه پیام با فرمت RFC 822 را از هر یک از سه رشته جدید در صندوق ورودی Gmail کاربر دریافت میکند، یک لکه از محتوای ایمیل (شامل پیوستها) ایجاد میکند و آن را در یک گروه Google در دامنه درج میکند.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Admin SDK Groups Migration service enables administrators to migrate emails from public folders and distribution lists to Google Groups using Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eThis advanced service requires prior enabling in Google Workspace domains (including resellers) before use.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage the Admin SDK Groups Migration API to programmatically manage email migration workflows.\u003c/p\u003e\n"],["\u003cp\u003eSample code provided demonstrates how to migrate RFC 822 formatted emails from Gmail to a designated Google Group.\u003c/p\u003e\n"],["\u003cp\u003eComprehensive documentation and support resources are available to guide developers in utilizing the service effectively.\u003c/p\u003e\n"]]],[],null,["# Admin SDK Groups Migration Service\n\nThe Admin SDK Groups Migration service allows you to use the Admin SDK's\n[Groups Migration API](/admin-sdk/groups-migration) in Apps Script. This\nAPI gives administrators of Google Workspace domains\n(including resellers) the\nability to migrate emails from public folders and distribution lists to\nGoogle Groups discussion archives.\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n---------\n\nFor detailed information on this service, see the\n[reference documentation](/admin-sdk/groups-migration/v1/reference)\nfor the Admin SDK Groups Migration API. Like all advanced services in Apps\nScript, the Admin SDK Groups Migration service uses the same objects, methods,\nand parameters as the public API. For more information, see [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[Admin SDK Groups Migration support guide](/admin-sdk/groups-migration/support).\n\nSample code\n-----------\n\nThe sample code below uses [version 1](/admin-sdk/groups-migration/v1/reference)\nof the API.\n\n### Migrate emails from Gmail to a Google Group\n\nThis sample gets three RFC 822 formatted messages from the each of the latest\nthree threads in the user's Gmail inbox, creates a blob from the email content\n(including attachments), and inserts it in a Google Group in the domain. \nadvanced/adminSDK.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/adminSDK.gs) \n\n```javascript\n/**\n * Gets three RFC822 formatted messages from the each of the latest three\n * threads in the user's Gmail inbox, creates a blob from the email content\n * (including attachments), and inserts it in a Google Group in the domain.\n */\nfunction migrateMessages() {\n // TODO (developer) - Replace groupId value with yours\n const groupId = 'exampleGroup@example.com';\n const messagesToMigrate = getRecentMessagesContent();\n for (const messageContent of messagesToMigrate) {\n const contentBlob = Utilities.newBlob(messageContent, 'message/rfc822');\n AdminGroupsMigration.Archive.insert(groupId, contentBlob);\n }\n}\n\n/**\n * Gets a list of recent messages' content from the user's Gmail account.\n * By default, fetches 3 messages from the latest 3 threads.\n *\n * @return {Array} the messages' content.\n */\nfunction getRecentMessagesContent() {\n const NUM_THREADS = 3;\n const NUM_MESSAGES = 3;\n const threads = GmailApp.getInboxThreads(0, NUM_THREADS);\n const messages = GmailApp.getMessagesForThreads(threads);\n const messagesContent = [];\n for (let i = 0; i \u003c messages.length; i++) {\n for (let j = 0; j \u003c NUM_MESSAGES; j++) {\n const message = messages[i][j];\n if (message) {\n messagesContent.push(message.getRawContent());\n }\n }\n }\n return messagesContent;\n}\n```"]]