Is there any way to programmatically archive courses in Google Classroom through the API?
I have some sample code from Google on updating specific fields. Could I just use this code and substitute whichever field indicates 'Archived' to this?
string courseId = "123456";
var course = new Course
{
Section = "Period 3",
Room = "302"
};
var request = service.Courses.Patch(course, courseId);
request.UpdateMask = "section,room";
course = request.Execute();
Console.WriteLine("Course '{0}' updated.\n", course.Name);
course = service.Courses.Update(course, courseId).Execute();
Console.WriteLine("Course '{0}' updated.\n", course.Name);
Thank you
Try using update()
and update the courseStates
to Archived
. This will make the course to be archived. Note that you cannot modify it except to change it to a different state.
Request parameters
id = 1234567890
Request body
{
"courseState": "ARCHIVED",
"name": "Test Course"
}
Hope this helps.