I know this doesn't solve the OP's particular problem, but I thought I'd add some examples of this using Canvas Data for the Group.
Supply the course_id and the filename, returns a list of pages in the course with that file. Can be used to find any string.
I append the Term, because it's often useful when you expand the scope beyond a single course.
-- target a course, and search for a stringSELECT wiki_page_dim.title AS page_title, course_dim.canvas_id AS course_id, course_dim.name AS course_name, enrollment_term_dim.name AS term_nameFROM CanvasLMS.dbo.wiki_page_dim JOIN CanvasLMS.dbo.wiki_page_fact ON wiki_page_dim.id = wiki_page_fact.wiki_page_id JOIN CanvasLMS.dbo.course_dim ON wiki_page_fact.parent_course_id = course_dim.id JOIN CanvasLMS.dbo.enrollment_term_dim ON course_dim.enrollment_term_id = enrollment_term_dim.idWHERE course_dim.canvas_id = 123456 AND body LIKE '%Clock Icon.jpg%';
Here's a query to find EVERY course a file is used in, across terms with some additional details.
We use this to track course content because we version courses with an image file naming convention.
-- PATINDEX is MSSQL specific, there are alternatives for other DB EnginesSELECT file_dim.canvas_id AS file_id, display_name AS file_name, user_dim.canvas_id AS user_id, user_dim.name AS uploaded_by, course_dim.canvas_id AS course_id, course_dim.name AS course_name, course_dim.created_at AS course_created_at, account_dim.canvas_id AS account_id, account_dim.name, account_dim.parent_account, account_dim.grandparent_account, enrollment_term_dim.canvas_id AS term_id, enrollment_term_dim.name AS term_nameFROM CanvasLMS.dbo.file_dim JOIN CanvasLMS.dbo.user_dim ON file_dim.uploader_id = user_dim.id JOIN CanvasLMS.dbo.account_dim ON file_dim.account_id = account_dim.id JOIN CanvasLMS.dbo.course_dim ON file_dim.course_id = course_dim.id JOIN CanvasLMS.dbo.enrollment_term_dim ON course_dim.enrollment_term_id = enrollment_term_dim.idWHERE PATINDEX('OBL-%-%-[0-9].[0-9].png',display_name) = 1;-- for specific files, use a filename-- WHERE display_name = 'OBL-WorldHistory-S1-1.0.png'
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.