问题描述
我可以使用Google脚本将一些数据从Google教室移到电子表格。特别是任何课堂课程或课程作业。当我尝试访问课程时遇到许可错误。
(方法listAssigments正常工作需要细化工作缓慢)
(方法listGrades在var提交时给出和许可错误)
我已经按照入门中的描述设置了API,但没有添加任何其他授权。
我原本以为是因为我创建了它Google教室,但是当我使用该网站时,这个工作正常。当我将请求直接发送到Web时,我再次遇到错误。
我知道它可以在多个附加组件中获得信息,但我找不到任何不是python的示例代码。我正在尝试制作一张简单的电子表格,它会根据我的成绩簿中的需要对它进行排序。任何工作都可以。尽管我希望能够将成绩推回谷歌。在课堂上添加参与点确实很慢,我宁愿只复制下来,更改任何异常情况或在另一个电子表格中粘贴评分。
我会在添加代码它有帮助,但我相信它必须是某种额外的认证或需要提供或添加的权限。
pre $
函数listGrades(courseWorkId ,课程){
var courseId = course.id
var ss = SpreadsheetApp.getActive()。getSheetByName(course.name);
var提交= Classroom.Courses.CourseWork.StudentSubmissions.list(4140802199,4801051201);
var grade = submissions.studentSubmissions [0] .assignedGrade
}
函数listAssigments(course){
var courseId = course.id
var courseWork = Classroom.Courses.CourseWork.list(courseId).courseWork
var ss = SpreadsheetApp.getActive()。getSheetByName(course.name);
for(var i = 0; i< courseWork.length; i ++){
var tittle = courseWork [i] .title
var points = courseWork [i]。 creationTime
var id = courseWork [i] .id
var id = courseWork [i]
ss.getRange(2,i + 5).setValue(tittle);
ss.getRange(3,i + 5).setValue(points);
ss.getRange(1,i + 5).setValue(id);
}
帖子。
函数createCoursework(id){
Classroom.Courses。
courseId:id,
title:'foo',
description :'desc',
});
}
正如Tom Hinkle所说。它不起作用,但会触发您访问数据所需的授权。
I have been able to move some data from google classroom to a spreadsheet using google script. Specifically anything in classroom courses or course work. I get a permission error when I try to access and thing in coursework.
(method listAssigments works fine needs refinement works slow)(method listGrades gives and permission error at var submissions)
I have set up the API as describe in getting started, but have not added any other authorization.
I originally thought it was because I created it in Google classroom, but when I use the site https://developers.google.com/classroom/reference/rest/v1/courses.courseWork.studentSubmissions/list The try this works fine. When I put the request directly to the web I get the error again.
I know it can work several add-ons get in information, but I can not find any example code that is not python. I am trying to make a simple spreadsheet that will sort the grade as I need them for my grade book. Any work around would be fine. Though I would like to be able to push grades back to google as well. Adding participation points is really slow in classroom, I would rather just copy down and change any anomalies or paste in grade for an another spreadsheet.
I will add the code in case it helps, but I believe it must be some sort of additional authentication or permission needed to provide or add.
function listGrades(courseWorkId, course) {
var courseId = course.id
var ss = SpreadsheetApp.getActive().getSheetByName(course.name);
var submissions = Classroom.Courses.CourseWork.StudentSubmissions.list(4140802199, 4801051201);
var grade = submissions.studentSubmissions[0].assignedGrade
}
function listAssigments(course) {
var courseId = course.id
var courseWork = Classroom.Courses.CourseWork.list(courseId).courseWork
var ss = SpreadsheetApp.getActive().getSheetByName(course.name);
for(var i = 0; i < courseWork.length; i++) {
var tittle = courseWork[i].title
var points = courseWork[i].creationTime
var id = courseWork[i].id
var id = courseWork[i]
ss.getRange(2, i+5).setValue(tittle);
ss.getRange(3, i+5).setValue(points);
ss.getRange(1, i+5).setValue(id);
}
I found a workaround from another post. I did not have a high enough score to post there.
function createCoursework (id) {
Classroom.Courses.CourseWork.create(id,
{ // doesn't work but triggers permissions correctly
"courseId": id,
"title": 'foo',
"description": 'desc',
});
}
As Tom Hinkle said. It does not work but it does trigger the authorization you need to access the data.
这篇关于Permission denied using Classroom.Courses.CourseWork.StudentSubmissions.list(4140802199,4801051201);的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!