Google Classroom 外掛程式現已全面開放開發人員使用!詳情請參閱
外掛程式說明文件。
附件探索 iframe
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
老師在建立 Classroom 作業時開啟外掛程式,一開始會看到附件探索 iframe。附件是指您希望學生互動的內容或活動。
老師在 Classroom 課程中建立新訊息 (例如作業、公告或問題),然後從外掛程式下拉式清單中選取外掛程式 (圖 1)。
圖 1. 顯示作業建立畫面,包括老師可附加的外掛程式選項。
老師選取外掛程式後,Classroom 會建立附件探索 iframe,並載入外掛程式的啟動網址。所有相關的 iframe 查詢參數都會傳遞至啟動網址 (圖 2)。

圖 2. iframe 中的附件探索 UI 範例。
您可以將「附件探索」檢視畫面視為外掛程式中老師的到達網頁。通常老師會在 iframe 中使用合作夥伴的網路應用程式,選取要附加至串流項目的內容。外掛程式應用程式可能會根據串流項目是公告、作業還是課程教材,限制顯示的內容。外掛程式應用程式接著會發出 Classroom API 呼叫,建立附件並附加至作業。
老師選取並建立完附件後,外掛程式會傳送 postMessage
酬載,要求關閉 iframe。iframe 會關閉,老師接著會看到附件,並選擇預覽或從作業中移除附件 (圖 3)。老師完成建立流程,將串流項目指派給學生。

圖 3. 查看作業建立畫面,其中包含三種活動類型外掛程式附件。
使用者體驗考量事項
- 首次開啟時,外掛程式必須提示老師登入。
- 所有 Classroom API 呼叫都必須使用 Google 單一登入。如果產品有獨立的登入系統,請務必連結帳戶。
- 老師必須能在 iframe 中預覽附件,才能做出最終選擇。
- 老師應能搜尋或瀏覽可附加的內容。
- 外掛程式可能會提供各種檢視畫面,例如近期內容、我的內容,以及依學習技能篩選。
- 外掛程式必須提供在 iframe 中建立新可附加項目的功能。
如要進一步瞭解使用者體驗規定,請參閱 Classroom 外掛程式規定檢查清單。
授權狀態
如果外掛程式需要產品授權,請顯示清楚的訊息,說明沒有授權的老師該如何解決問題。此外,如果內容因授權限制而無法提供給老師,也請考慮隱藏或停用。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],null,["# Attachment Discovery iframe\n\nThe **Attachment Discovery iframe** is the initial view shown to a teacher when\nopening an add-on during the creation of a\nClassroom task. An\n**attachment** is the content or activity that you intend for students to\ninteract with.\n\nFrom within a Classroom course, a teacher creates a new post (for\nexample, an assignment, announcement, or question) and selects an\nadd-on from the add-on\ndrop-down list (Figure 1).\n\n**Figure 1.** View of an assignment\ncreation including the possible add-on options a\nteacher can attach.\n\nOnce a teacher selects an add-on,\nClassroom creates an Attachment Discovery iframe and loads the\nadd-on's launch URL. Any relevant [iframe query\nparameters](/workspace/classroom/add-ons/developer-guides/iframes) are passed to the launch URL (Figure 2).\n\n**Figure 2.** An example of an **attachment discovery** UI in an iframe.\n\nThink of the Attachment Discovery view as the landing page for teachers in your\nadd-on. Typically, the teacher uses the partner's web\napplication within the iframe to select content to attach to their stream item.\nThe add-on application might restrict which content is\nshown depending on whether the stream item is an announcement, assignment, or\ncourse material. The add-on application then makes\nClassroom API calls to create and attach the attachment to the\nassignment.\n\nWhen the teacher is finished selecting and creating attachments, the\nadd-on sends a `postMessage` payload requesting the\niframe to be closed. The iframe closes and the teacher then sees the\nattachments, which they might then choose to preview or remove from the\nassignment (Figure 3). The teacher completes the creation flow by assigning the\nstream item to their students.\n\n**Figure 3.** View of an assignment creation with three activity-type\nadd-on attachments.\n\nUser experience considerations\n------------------------------\n\n- On initial opening, the add-on must prompt the teacher to sign in.\n- Google single sign-on is required for all Classroom API calls. If your product has a separate login system, you must link accounts.\n- A teacher must be able to preview an attachment within the iframe before making their final selection.\n- A teacher should be able to search for, or browse through, attachable content.\n- The add-on may provide a variety of views such as recent content, my content, and filter by learning skills.\n- The add-on must provide an ability to create a new attachable item from within the iframe.\n\nSee the Classroom add-on [requirements checklist](/workspace/classroom/add-ons/requirements) for more details\non user experience requirements.\n\nLicensing status\n----------------\n\nIf your add-on requires a license to your product, a\nclear message should be shown to explain how a teacher without a license can\nremedy the situation. Consider also hiding or disabling content that's not\navailable to a teacher due to licensing restrictions."]]