I could use win32client to read msg file yesterday, but all of a sudden it throws an error today while I'm running the same code against same file.
Couldn't find the reason. There is not much explanation about the error message. There was an Internet outage yesterday which had been restored later, but it doesn't seem to be a cause.
import win32com.client as win32
outlook = win32.Dispatch('Outlook.Application').GetNameSpace('MAPI')
msg = outlook.OpenSharedItem('path/file.msg')
print(msg.SenderName)
When it worked yesterday, the output was apparently a name, such as Joe Doe, but today it is an error message pasted below.
com_error: (-2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', "We can't open 'RE Your Sumo Invoice - Gas.msg'. It's possible the file is already open, or you don't have permission to open it.\n\nTo check your permissions, right-click the file folder, then click Properties.", None, 0, -2147287038), None)