Resync Library Override using Python

Hi,
I am developing an addon to manage the pipeline of a feature film on Blender, but I am stuck on a feature.
I would like to be able to automatically resync collections that have been linked and overrided.
There is an operator
bpy.ops.outliner.id_operation (type = 'OVERRIDE_LIBRARY_RESYNC_HIERARCHY')
But this requires having selected the collection beforehand, otherwise Blender will crash.
I haven’t found a solution to select a collection in the outliner using Python.
I tried to pass a context override when I call the operator, to change the 'selected_ids' and 'collection', but it doesn’t work.
Does anyone have a clue to select and resync a collection using Python?

2 Likes