I need to access with javascript to studend submissions of a courseWork created to by javascripts code and from de same project that I make this request. I tryed before with a .NET project and the request return the student submissions and I can to use you fields.
I show here de code:
try {
console.log("CONSOLE REGISTER: ScourseId is " + idcourse + ", and idcourseork is " +
idcourseWork);
async () => { gapi.client.classroom.courses.courseWork.studentSubmissions.list({
courseId: idcourse, courseWorkId: idcourseWork }).then(function (data2) {
console.log("This message is not showed because the classroom API return nothing.
The next code is not executed");
var studentSubm = data2.result.studentSubmission;
console.log(studentSubm);
for (b = 0; b < studentSubm.length; b++) {
console.log("Mark 1");
if (!(studentSubm[b].state == "RETURNED")) {
var idestudiante = studentSubm[b].userId;
api.client.classroom.courses.students.list({ idcourse, idcoursework, idestudiante
}).then(function (data3) {
var userProfile = data3.result.profile;
if (!(studentSubm[b].attachments == null)) {
document.write("<div class='divcont' ><div class='divizqu' class='det1'
id='" + Cp.Left(studentSubm[b].title, 40) + "'>" + studentSubm[b].title +
"</div><div class='divdere'><button class='boton'
onclick=enviaridstudentsubmission('" + idcourse + "','" +
courseWorks[p].id + ",'" + studentSubm[b].id + "')>Ver</button></div>
</div>n");
}
});
}
}
});
}
} catch (err) {
console.log(err.message);
return;
}
Any error is not returned. The brower register console show the courseId and the idcourseWork. They are corrects.This line stoping de execution:
api.client.classroom.courses.students.list({ idcourse, idcoursework, idestudiante }).then(function (data3)
However I revised every word and every letter. It is maked that similar mode that other methods that run ok.
Before this register show the field “associatedWithDeveloper” that with “true” value.
I shouldn’t have any problems accessing the submissions list, but if I can, when I can do it from a .NET client with the same project.
The HTML page contains all the necessary Classroom API permissions to perform this access. This cause can be ruled out. It doesn’t return that error either.