Google Workspace管理员:如何通过Apps Script添加外部Gmail用户至Classroom班级
问题:通过Google Apps Script调用Classroom API邀请外部Gmail用户时触发权限错误
问题详情
- 身份:Google Workspace组织管理员
- 目标:使用Google Apps Script调用Classroom API,邀请外部Gmail用户(@gmail.com)加入Classroom班级并成为学生
- 使用的代码:
Classroom.Invitations.create({ "userId": email, "courseId": courseId, "role": "STUDENT" });
- 异常情况:代码对本组织域内邮箱可正常执行,但邀请外部Gmail用户时返回以下错误:
GoogleJsonResponseException: API call to classroom.invitations.create failed with error: The caller does not have permission
- 补充说明:可以通过Google Classroom手动添加该外部用户;班级所有者为同域内其他账号;脚本存储在共享云端硬盘中
解决方法
要让脚本成功发起外部用户邀请,执行脚本的管理员账号必须先被添加为该课程的教师。
内容的提问来源于stack exchange,提问作者Pion Developer
相关产品推荐
相关产品推荐

