[PLUG] python win32com and outlook
Brought to you by:
acooks,
datadictator
From: Stefan S. <sc...@gm...> - 2012-01-09 14:10:28
|
Hi I have recently started playing with win32com and am currently trying to use python to perform various tasks on microsoft outlook with the win32com module. To get hold of the outlook object, I can use either the statement 'outlook = Dispatch("Outlook.Application")' or 'outlook = GetActiveObject("Outlook.Application")', depending on whether Outlook is open or not. The problem is that this works, but not reliably. Very often, a message will come back: dispatch = pythoncom.GetActiveObject(resultCLSID) com_error: (-2147221021, 'Operation unavailable', None, None) I cannot figure out what changes - sometimes it works, often it does not. I thought that this has maybe something to do with Windows 7 security, but various forums seem to have had these discussions since 2005. And there don't seem to be any real solutions proposed. On one forum they mentioned that launching Internet Explorer is a problem, because it does not register with the Running Object Table. If this was the problem in my case, I should surely never be able to work with Outlook? Things that could potentially cause the problem - does waking up a laptop from sleep/hybernation maybe cause this problem? Is there a built-in security feature in Outlook that sometimes interferes with the win32 api? Has anyone worked with this? Any ideas? Regards |