function testScripts() {
var courses = [12345678902, 123425373134];
var newTeacher = ["teacher@mail.com", "teacher@mail.com"];
for (x = 0; x <= courses.length - 1; x++) {
var final = courses[x];
var finalT = newTeacher[x];
var addTeacher = Classroom.Courses.Teachers.create(
{ userId: finalT }, final
);
}
}
I've tried this code but it gives me this error: GoogleJsonResponseException: API call to classroom.courses.teachers.create failed with error: Requested entity already exists
Only the first course in the array is updated with the new teacher to be added.
Thank you!