Google Classroom アドオンの一般提供が開始されました。詳しくは、
アドオンのドキュメントをご覧ください。
添付ファイルの検出 iframe
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
添付ファイル検出 iframe は、教師が Classroom の課題の作成中にアドオンを開いたときに最初に表示されるビューです。添付ファイルとは、生徒に操作してほしいコンテンツやアクティビティのことです。
Classroom のコース内で、教師が新しい投稿(課題、お知らせ、質問など)を作成し、アドオンのプルダウン リストからアドオンを選択します(図 1)。
図 1. 教師が添付できるアドオン オプションを含む、課題の作成画面。
教師がアドオンを選択すると、Classroom は添付ファイル検出 iframe を作成し、アドオンの起動 URL を読み込みます。関連する iframe クエリ パラメータは、起動 URL に渡されます(図 2)。

図 2. iframe 内の添付ファイルの検出 UI の例。
添付ファイル検出ビューは、アドオンの教師向けランディング ページと考えてください。通常、教師は iframe 内のパートナーのウェブ アプリケーションを使用して、ストリーム アイテムに添付するコンテンツを選択します。アドオン アプリケーションは、ストリーム アイテムがお知らせ、課題、コース教材のいずれであるかに応じて、表示されるコンテンツを制限する場合があります。アドオン アプリケーションは、Classroom API 呼び出しを行い、課題に添付ファイルを作成して添付します。
教師が添付ファイルの選択と作成を完了すると、アドオンは iframe の終了をリクエストする postMessage
ペイロードを送信します。iframe が閉じ、教師に添付ファイルが表示されます。教師は、添付ファイルをプレビューするか、課題から削除するかを選択できます(図 3)。教師は、ストリーム アイテムを生徒に割り当てることで作成フローを完了します。

図 3. 3 つのアクティビティ タイプのアドオン添付ファイルを含む課題の作成画面。
ユーザー エクスペリエンスに関する考慮事項
- 初回起動時に、アドオンは教師にログインを求める必要があります。
- すべての Classroom API 呼び出しで Google シングル サインオンが必要です。プロダクトに個別のログイン システムがある場合は、アカウントをリンクする必要があります。
- 教師は、最終選択を行う前に、iframe 内で添付ファイルをプレビューできる必要があります。
- 教師は、添付可能なコンテンツを検索またはブラウジングできる必要があります。
- アドオンでは、最近のコンテンツ、自分のコンテンツ、学習スキルによるフィルタなど、さまざまなビューが提供される場合があります。
- アドオンは、iframe 内から新しい添付可能なアイテムを作成する機能を提供する必要があります。
ユーザー エクスペリエンスの要件について詳しくは、Classroom アドオンの要件チェックリストをご覧ください。
ライセンス ステータス
アドオンでプロダクトのライセンスが必要な場合は、ライセンスのない教師が状況を改善する方法を説明する明確なメッセージを表示する必要があります。ライセンス制限により教師が利用できないコンテンツは、非表示にするか無効にすることも検討してください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-29 UTC。
[null,null,["最終更新日 2025-08-29 UTC。"],[],[],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."]]