Replies: 1 comment
-
I got this response in the UCF Slack from @shaneros: Okay, I think this is the way to do it… This creates a migration with the waiting_for_selection state (just like you would in the UI). From there, to figure out what to do, I looked at migration.get_selective_data() . Based on what’s there (and by reviewing the API calls that happen from the browser when initiating an import), I saw you can update the migration with a copy argument in this format: In your case, be sure to remove / set False the announcements and calendar events keys. That’ll initiate the import. From there you can check migration.get_progress() to keep track of the progress/workflow_status as Canvas copies things over. Thank you @shaneros |
Beta Was this translation helpful? Give feedback.
-
I am trying to get this course migration function working. I want to migrate all of the course content from a previous course except for the Announcements or Calendar Events. I just need help understanding how to make the "select" argument work since I know all the other arguements are working well from my testing. This is what I have:
course_migration = course.Course.create_content_migration(self=to_course, migration_type='course_copy_importer', settings = {'source_course_id': from_course_id},select = {'folders', 'files', 'attachments', 'quizzes', 'assignments', 'discussion_topics', 'modules', 'module_items', 'pages', 'rubrics'], date_shift_options={'shift_dates': True, 'old_start_date':old_start_date, 'new_start_date':start_date})
I was told by @shaneros in the UCF Discord that it should look like this:
select={ 'files' : ['file_id_1', 'file_id_2'...], 'quizzes' : ['quiz_id_1', 'quiz_id_2'...] ... }
That said, I am not sure what to do with this new information since I am not sure how I am supposed to pass through all of the items for each key. It looks like I need to figure out how to pass each object but I don't even know what that looks like. How do I get all the items in the previous course to copy over except the Announcements and Calendar Events?
If there isn't an easy solution for excluding Announcements and Calendar Events from a migration, how would I then go about deleting all of the Announcements and Calendar Events in the course I am copying to? I see there is a class CalendarEvent but no class I see for "Announcement" (Does it go by a different name?). Also I am unclear about which function in which class I would use to get all of the Announcement and Calendar Event objects so that I can call a delete() function in a for loop for them.
I know this is a lot but this is the last hurdle in a project I am working on and I have hit a wall with my understanding of how the API works. Thank you for any assistance and guidance you can give!
Beta Was this translation helpful? Give feedback.
All reactions