Teachers have the ability to copy assignments in Classroom. Doing so also copies the add-on attachments that are contained within the assignments. This saves teachers a lot of time when creating assignments for multiple sections or for new sections each school year.
When teachers copy an assignment in Classroom, the copied
assignment has different courseId
, itemId
, and attachmentId
query
parameters compared to the original assignment.
How to copy content
The following sections describe how teachers can copy assignments in Classroom.
Copy a course
When copying a course, all of the assignments in the course are copied to the new course as drafts. The teacher may then publish the assignments to students enrolled in the new course. A student may be enrolled in the original course and the copied course. This can happen if a student is held back or retaking a class.
Figure 1. Teachers can copy courses by navigating to the vertical dotted menu in Classroom and clicking Copy. Then, the teacher can specify details about the course in the pop-up and copy it.
Publish an assignment to multiple courses
A teacher can publish an assignment to more than one course through the assignment creation page. it's possible that a student is enrolled in both courses.
Figure 2. Teachers can publish an assignment to more than one course by clicking the drop-down in the sidebar on the assignment creation page and selecting multiple course(s).
Reuse a post
A teacher can reuse a post by navigating to the Classwork tab and clicking Create. From the drop-down, they can click Reuse post to select a class and then select the assignment to reuse.
Figure 3. Teachers can begin the flow of reusing a post from the Classwork tab and click Reuse post.
Figure 4. After clicking Reuse post, teachers can select a class and the assignment they want to reuse.
Expected behavior
When a course or assignment is copied, the same student may be assigned the same add-on attachment across different courses. The recommended behavior for add-ons in the copied assignment should be to:
- Ensure that teachers can still preview the attachment in the
teacherViewUri
. If your add-on requires licensing and the teacher has not appropriately set up a copied course, display a user-friendly message informing the teacher what the appropriate course of action is. At the very least, teachers must not see an error page in the iframe. - Ensure that students see a new add-on attachment in the
studentViewUri
. For activity-type attachments, this means that the attachment is incomplete and the student shouldn't be able to see any of their responses from another course. If your add-on doesn't allow the same student to complete an attachment twice, display a user-friendly message describing the scenario or a path to resolve the issue. For content-type attachments, this means displaying the content for the student to see in thestudentViewUri
. At the very least, students must not see an error page in the iframe. - Ensure that teachers see the student submission from the copied assignment
in the
studentWorkReviewUri
. The teacher shouldn't be able to see a student's submission for the attachment from another course. At the very least, teachers must not see an error page in the iframe.
Teacher View iframe
When a teacher launches the teacherViewUri
, the attachmentId
is sent as a
query parameter in addition to courseId
, itemId
, itemType
, and
login_hint
(if the user has already authorized your app). The attachmentId
can be used to display the correct attachment in the iframe.
If you don't have a record of the query parameters on the teacherViewUri
, you
can use the CopyHistory
object in the AddOnAttachment
resource to
identify the original assignment. Then, you can display the correct attachment
in the teacherViewUri
.
Student View iframe
When a student launches the studentViewUri
, the attachmentId
is sent as a
query parameter in addition to courseId
, itemId
, itemType
, and
login_hint
(if the user has already authorized your app). In order to render
the studentViewUri
when an assignment or course is copied, use two parameters:
attachmentId
, which can be retrieved from the request URL.submissionId
, which can be retrieved by calling the appropriatecourseWork.getAddOnContext
,courseWorkMaterials.getAddOnContext
orannouncements.getAddOnContext
method based on theitemType
and reading theStudentContext
object.
The attachmentId
is a unique identifier for the attachment. The
submissionId
, however, is not guaranteed to be unique. Therefore, a copied or
reused assignment has a different attachmentId
, but the submissionId
may
remain the same. When the student launches the studentViewUri
, you can display
the attachment by identifying the student work based on a composite key of the
attachmentId
and submissionId
.
If the studentViewUri
is rendered based on the submissionId
alone, you risk
showing the student their submission from another course because the
submissionId
is not guaranteed to be unique.
As mentioned earlier, if you can't identify the attachmentId
, you can use the
CopyHistory
object in the AddOnAttachment
resource to identify the
original assignment and its query parameters.
Student Work Review iframe
When the teacher launches the studentWorkReviewUri
, the attachmentId
and the
submissionId
are sent as query parameters in addition to the courseId
and
itemId
and itemType
. You can use these query parameters to retrieve the
AddOnAttachment
resource or CopyHistory
resource if you can't identify
the attachmentId
provided. This lets you to search for the student work using
a composite key of the attachmentId
and submissionId
.