There is an error on line 11 stating:
Requested entity was not found. (line 11, file "Code")
createdCourse = Classroom.Courses.get('Bio10');
The function:
function createA_NewCourse() {
var courseNew,createdCourse;
courseNew = Classroom.newCourse();
courseNew.name = "10th Grade Biology";
courseNew.id = "Bio10";
Logger.log("course.name " + courseNew.name);//Verify that name was set
createdCourse = Classroom.Courses.get('Bio10');//Try to get course by ID
Logger.log(createdCourse)
}
How is a new course created in Apps Script?
As stated by @Dean Ransevycz, there should be a create()
method.
Here's a sample code:
function createCourses() {
var course;
course = Classroom.newCourse();
course.name = "10th Grade Biology";
course.ownerId = "me";
//course.id = "Bio10";
course = Classroom.Courses.create(course);
Logger.log('%s (%s)', course.name, course.id);
var list = Classroom.Courses.list();
Logger.log(list);
}
You're getting an Requested entity was not found.
error since you might be using the wrong course id. And I guess you can't set an ID when creating a course. (Source.)