Student Submissions - Google Classroom API Apps Sc

2019-08-14 14:48发布

So, I'm trying to use the new StudentSubmissions section of the API to search for student submissions in a particular course. When I try using the "Try It!" portion of the resource page, it works fine, but when I run it in my script, I get the following error:

"The caller does not have permission (line 6, file "silo test")"

I have also gotten the error "The requested identity does not exist"

I am a Super Admin on the domain, this is my course that I am the teacher of, and it should be noted that when I do Classroom.Courses.CourseWork.list(deCourse), it works fine and gives me an array of the coursework for the course, but the StudentSubmissions piece keeps erroring out. I know that I can add the userId separately do only look for a particular student, but that doesn't fix it either.

Thoughts?!

function siloTest() {

 var nick = { teacherId: "nmarchese@berkeleycarroll.org"} 
var courses = Classroom.Courses.list(nick);  
var deCourse = courses.courses[5].id;

   var late = Classroom.Courses.CourseWork.StudentSubmissions.list(deCourse, "-");  
}

1条回答
老娘就宠你
2楼-- · 2019-08-14 14:58

Make sure that your app script is associated with the correct dev console project. It should be associated with the dev console project id that corresponds with your OAuth 2.0 client ID. This should also have "Apps Script Execution API" enabled.

We have to assign permission under Developer Console Project for the project which the apps-script is associated. So follow these steps:

  • Open your apps script.
  • Go to Resources-Developers Console Project.
  • Click on the project name appearing in blue under "This script is currently associated with project:". It will redirect you to Developer Console Project.
  • Click on Menu on the left hand side upper corner and click on Permissions.
  • Under Permissions, click on Add members.
  • In the member, type the email ID or domain you want to provide permission and desired permission level.
  • Click on 'Add'.

Check these related questions:

查看更多
登录 后发表回答