【发布时间】:2017-05-11 08:57:28
【问题描述】:
有 1 个带有子域的域 - 分别为 school.com 和 students.school.com。
我使用谷歌应用脚本为每个班级创建了谷歌教室。
现在问题来了,
我正在尝试将教师和学生添加到 Google 课堂中。
我使用的“超级管理员”帐户在我的主域 (school.com) 中。
因此,我可以将教师添加到教室,但我无法将学生添加到教室,因为它属于子域 (students.school.com)
这是我的代码的样子,
function addTeachers() {
Classroom.Courses.Teachers.create({
userId: "teacher1@school.com",
}, "123456789");
}
function addStudents() {
Classroom.Courses.Students.create({
userId: "student@students.school.com",
}, "123456789");
}
当我运行addStudents函数时,出现这个错误,
Execution failed: The caller does not have permission
【问题讨论】:
-
不作为评论发布,因为我意识到它不直接属于 GAS,但您可以使用带有 API 和服务帐户的外部工具,通过模拟学生并添加到使用课程注册代码的课程。看看this explanation 是否有帮助。您可能无法在 GAS 中进行服务帐户,但 this may help you go in the right direction.
标签: google-apps-script google-apps google-classroom google-apps-for-education