Bulk Delete Enrollments From a Section (with no SIS ID)

Jump to solution
matt_borja
Community Novice

Hi all,

I understand that you cannot delete a section if there are enrollments. But if a course has a section that was added in Canvas directly (no SIS ID) and we wanted that section removed, yet that section has multiple enrollments, is there not a way to delete enrollments in bulk vs. one at a time?

Matt

Labels (1)
1 Solution
matt_borja
Community Novice
Author

Hi Brian,

Thanks for your response. I guess I should have provided a little more context: this is meant to be done over the API as it is actually a maintenance tool we've created that is meant to serve as a one-click "Fix It" for our administrators so they probably aren't going to want to go into each individual section to assign missing SIS IDs. Basically the policy is: instructors shouldn't be adding their own sections since they will be imported directly from source and those are the ones they should be using.

However, this does bring up one viable workaround to mind (I emphasize on workaround because this really ought to be part of the API):

To [Programmatically] Delete Section Enrollments in Bulk:

  1. Use the Sections API to Edit a Section and set the SIS ID (i.e. "SIS_PREFIX_<SECTIONID>") if it doesn't have one already. (Cost: 1 API call)
  2. Retrieve a list of Enrollments for the section. This can be wrapped into the same call used to get the section by passing the include[]=enrollments parameter. (Cost: 0-1 API calls)
  3. Format this [optionally filtered] list of Enrollments as a new SIS Import for Enrollments and set the status column to "deleted." (Cost: 1 API call)

Total cost: 2-3 API calls to delete some or all enrollments (using SIS) in a section.

Alternatively, if you have no need to filter which enrollments you are deleting in bulk and are essentially deleting ALL enrollments, you might also argue this could be easier done in two easier steps, but still costing 2 API calls:

  1. Set the SIS ID of a section
  2. Delete the section itself via SIS (while it has enrollments)

So I guess there you have it, deleting enrollments in bulk Smiley Happy

View solution in original post