from pathlib import Path
import win32com.client
# Creation du repertoire
output_dir = Path.cwd() / "Backup"
output_dir.mkdir(parents=True, exist_ok=True)
# Acceder à outlook
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
# Recuperer la boite de reception
inbox = outlook.GetDefaultFolder(6)
# lien du chemin
pst = str(output_dir / "backup.pst")
# Export inbox folder to PST file
inbox.Export(pst)
I'm trying to export my inbox from Outlook as a pst file but I'm getting an error with the export method. Does anyone have an idea?