Each outliner area has individual selection (blue highlight).
But only one active collection as seen below (gray highlight on icon).
If you press F2
in any one area, it renames the active selection in the area where your mouse is on.
But if you create an object, it will always be created under the active collection.
The bpy.ops.outliner.item_activate(extend=False, extend_range=False, deselect_all=False)
operator internally uses mouse position to select and activate items.
Also there is no active_item
like attribute associated with the OUTLINER
space you can use.
So you can't use python to manipulate active selection in the OUTLINER
.
However you can use bpy.data.collections
to modify collection
properties.
Please do tell what you cannot achieve without that selection.
If you want to rename a collection using python use any one of these:
bpy.data.collections[0].name = "new_name"
bpy.data.collections['current_name'].name = "new_name"