Javascript Google应用程序脚本中的课堂API个人学生选项
是否可以使用Google Apps脚本中的Javascript Google应用程序脚本中的课堂API个人学生选项,javascript,google-apps-script,google-classroom,Javascript,Google Apps Script,Google Classroom,是否可以使用Google Apps脚本中的个人学生选项对象?我正在尝试创建对象,但返回此错误 GoogleJsonResponseException:没有se-ha-Poddo-llamar-la-API教室。课程。课程作业。创建;错误:接收到无效的JSON负载。“课程工作”中的未知名称“individualStudentsOptions”:原型字段未重复,无法开始列表 这似乎是不可能从气体 function enviarclassdos(datos,alumnos){ // datos: o
个人学生选项
对象?我正在尝试创建对象,但返回此错误
GoogleJsonResponseException:没有se-ha-Poddo-llamar-la-API教室。课程。课程作业。创建;错误:接收到无效的JSON负载。“课程工作”中的未知名称“individualStudentsOptions”:原型字段未重复,无法开始列表
这似乎是不可能从气体
function enviarclassdos(datos,alumnos){
// datos: object with needed variables for classroom publishing
// alumnos: individual students (array [students])
var stdid = []; //Array of IDs of individual students
//Getting the IDs of the individual students
var hojacuentas = SpreadsheetApp.openById("1oHlpSyRB913LWpj-UNTKattO").getSheetByName("CUENTAS");
var datacuentas = hojacuentas.getDataRange().getValues();
for(var al =0; al<alumnos.length; al++){
var alum = alumnos[al][0];
for (var dt=0; dt<datacuentas.length; dt++){
var alumdt = datacuentas[dt][0];
if (alumdt == alum){
var cuenta = datacuentas[dt][3];
stdid.push(cuenta);}}}
var curso = datos.curso;
var tipo = datos.tipo;
if (curso == "Primero A"){var id = "14085771****";}
if (curso == "Primero B"){var id = "14085996****";}
if (curso == "Segundo A"){var id = "14085996****";}
if (curso == "Segundo B"){var id = "14085996****";}
if (curso == "Cuarto AB"){var id = "14085996****";}
var titulo = datos.concepto;
var descripcion = datos.descripcion;
var fecha = datos.fecha;
var tema = datos.tipo
var ClassSource =
{
title: titulo,
description: descripcion,
state: "PUBLISHED",
workType: "ASSIGNMENT",
topicId: tema,
maxPoints: 100,
assigneeMode: "INDIVIDUAL_STUDENTS"
}
//This is the object that produces the error message
ClassSource.individualStudentsOptions = {studentIds:stdid};
var clss = Classroom.Courses.CourseWork;
var wrk = clss.create(ClassSource, id);
}
函数enviarclassdos(DATO,校友){
//datos:具有课堂发布所需变量的对象
//校友:单个学生(数组[学生])
var stdid=[];//单个学生的ID数组
//获取每个学生的ID
var Hojacunteas=电子表格应用程序.openById(“1oHlpSyRB913LWpj UNTKattO”).getSheetByName(“CUENTAS”);
var datacuentas=hojacunteas.getDataRange().getValues();
对于(var al=0;al而不是
ClassSource.individualStudentsOptions = [{studentIds:stdid}];
使用
参考文献
ClassSource.individualStudentsOptions = {studentIds:[stdid]};