I WANT TO UNPUBLISH A CLASS THAT HAS BEEN COMPLETED.
Hi LD COBB , and Welcome to the Canvas Community!
Can I ask why?
There is really no need to unpublish a course once it has concluded. If you are looking to secure it from continued student access, there are better ways. If you could tell us exactly what you are trying to do, we can provides some good guidance, but in the meantime...........
I want to close the course so that students cannot see anything -- assignments, gradebook, announcements, etc.
Lona D. Cobb, PhD
MCM Faculty Internship Coordinator
Communication and Media Studies Department
Winston-Salem State University
Office: 121 Hall-Patterson
CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it may contain privileged, confidential, administrative information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you are not the intended recipient of this transmission or a person responsible for delivering it to the intended recipient, any disclosure, copying, distribution, or other use of any of the information in this transmission is strictly prohibited. If you have received this transmission in error, please notify me immediately by reply e-mail or by telephone at the number listed above.
That is what I suspected, LD , and you can learn how that can be accomplished in that second link I provided.
I am wondering if an answer to the OP's original question was ever found (even though it turned out there was probably an alternative way to meet her needs).
I am currently looking for a way to unpublish concluded courses, as well, via the API. Since we're using the API, un-concluding and unpublishing the course would be an option, too, but, frustratingly, "un-conclude" doesn't seem to be an option available via the API, only the GUI.
The situation is this: we have courses that open and close at "off" times throughout the year, outside of the normal term start and end dates. Some of them have rolling admissions, others are seminars that span multiple terms, etc. When these courses end, we want to conclude them and put them into read-only mode. Then, a certain number of days later, we want to remove access entirely.
For "normal" courses, we accomplish this by setting the term end date several weeks later than the actual course end date, and setting "restrict students from accessing after" at the sub-account level.
For these long and short courses, though, we're overriding the term dates. Unpublishing them would seem like the best way to completely remove student access at the end of the "read-only" period. The other alternative would be to create a special term for every course, but that's not sustainable; there are dozens of them every year.
Shared to Canvas Admins and Canvas Developers, as well.
Hi Jay Savage
Yes, a course can be unpublished! You can learn more at How do I publish a course? However, once your course includes graded submissions, it can no longer be unpublished.
The methods I originally described are still your best bet; however, depending on the numbers of such courses, I would suspect that doing this through a CSV upload would be the most efficient way of accomplishing this for many courses. One useful trick might be creating a separate term or even sub-account for these courses to make finding and managing them more efficient.
Hi Kelly, unfortunately, as I explained, what was suggested doesn't work. Restricting access after the end date restricts access *at* the end date. We don't want that. We want the default read-only behavior. But only for a certain number of days (90), not until the end of the term, whenever that may be.
Obviously courses have graded content by the end of the semester (again, as I said), so no, they definitely, absolutely, can't "be unpublished!".
And since "un-conclude" doesn't appear to available via the API--and you can't change the effective dates of a concluded course via the API, either--it doesn't seem possible to retroactively restrict viewing in an automated way.
And, again, creating special term defs and sub-accounts is not sustainable at volume. We already have 24 Canvas terms per academic year and a proliferation of subaccounts to accommodate "normal" start and end dates; I'm not adding more to accommodate one-offs.
*IF* courses are created with the correct settings *and* nobody messes with them in the interim, we can go through and use restrict_student_past_view (https://canvas.instructure.com/doc/api/courses.html#method.courses.update_settings) to lock them after the fact, but if restrict_enrollments_to_course_dates gets unchecked manually that doesn't work.
There's no good way (apparently), to reliably remove access to a number of courses in bulk, at a particular point in time.
That's why I'm interested in hearing whether there was ever a good solution to OP's *original* question.
For the record, this is the current, partially effective, code. It works pretty well for courses that haven't been manually concluded, but what we really need is a faculty-proof way to make sure view access is removed after 90 days:
for c in ol.get_courses() : if c.end_at is None : continue # can't know if we're past end if we don't know end end = datetime.datetime.strptime(c.end_at, '%Y-%m-%dT%H:%M:%SZ') if end < (now - datetime.timedelta(days=90)) : try : c.update_settings(restrict_student_past_view='true') c.update(restrict_enrollments_to_course_dates='true') try: print(c.sis_course_id, "|", c, "|", c.end_at) # catch wide characters in output before cron does except: pass except Exception as e : print(e)
Retrieving data ...