שירות העברת קבוצות ב-SDK של מנהל מערכת
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
שירות העברת קבוצות ב-Admin SDK מאפשר לכם להשתמש ב-Groups Migration API של Admin SDK ב-Apps Script. ה-API הזה מאפשר לאדמינים של דומיינים ב-Google Workspace (כולל משווקים) להעביר אימיילים מתיקיות ציבוריות ומקבוצות תפוצה לארכיונים של דיונים בקבוצות Google.
חומרי עזר
מידע מפורט על השירות הזה זמין במסמכי העזרה בנושא Admin SDK Groups Migration API. בדומה לכל השירותים המתקדמים ב-Apps Script, שירות העברת הקבוצות של Admin SDK משתמש באותם אובייקטים, שיטות ופרמטרים כמו ממשק ה-API הציבורי. מידע נוסף זמין במאמר איך נקבעות חתימות של שיטות.
כדי לדווח על בעיות ולמצוא תמיכה נוספת, אפשר לעיין במדריך התמיכה בנושא העברת קבוצות Admin SDK.
קוד לדוגמה
בדוגמת הקוד שבהמשך נעשה שימוש בגרסה 1 של ה-API.
העברת אימיילים מ-Gmail לקבוצת Google
בדוגמה הזו מתקבלות שלוש הודעות בפורמט RFC 822 מכל אחד משלושת השרשורים האחרונים בתיבת הדואר הנכנס של המשתמש ב-Gmail, נוצר blob מתוכן האימייל (כולל קבצים מצורפים) והוא מוכנס לקבוצת Google בדומיין.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-31 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-31 (שעון UTC)."],[[["\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```"]]