First of all, thanks for engaging on this conversation!
Exactly in VBA I had a Macro which was able to look for a folder I search by words and then open it with:
Set objFolder = GetFolder(MyfTxt)
Set objOlApp.ActiveExplorer.CurrentFolder = objFolder
Yes, it worked, open the folder and navigation panel re-focused as desired.
But my company has remove Macros from outlook and I had to become creative using python instead:
if temp_folder_obj:
outlook_app = win32com.client.Dispatch("Outlook.Application") # Get app object
explorer = outlook_app.ActiveExplorer()
# Check if the stored folder object is still valid
try:
_ = temp_folder_obj.Name # Access a property to check validity
folder_object_to_open = temp_folder_obj # It's valid, use it
except pythoncom.com_error:
# Object likely invalid, try resolving by path again
.......
# Navigate in Outlook if we have a valid object
if folder_object_to_open:
explorer.CurrentFolder = folder_object_to_open
window['-STATUS-'].update(f'Opened: {selected_path}')
sg.popup_quick_message(f'Navigated to: {selected_path}', auto_close_duration=3) #, location=window.current_location())
else:
# This means re-resolving also failed
raise Exception("Could not re-validate or resolve folder object.")
in python explorer.CurrectFolder = folder_object_to_open
does open the folder and I can see all the emails in the Folder, but the navigation pane does not re-focus, forcing me to scroll down the many folders until I recognized the open folder in "bold"
Looking forward for your feedback.
Regards,
Vic