0
votes

So I'm using Microsoft Office 365 ProPlus on my Windows 10.

I wrote a python script that copies my emails from one account to the other and back.

My python version is 3.7.3

pywin32 version is 223

This script has worked totally fine for two months. A few days ago it suddenly stopped working. I investigated and got the following error:

pywintypes.com_error: (-2147352567, 'Ausnahmefehler aufgetreten.', (4096, 'Microsoft Outlook', 'Ein Fehler ist aufgetreten. MAPI-Fehlernummer: 80004001', None, 0, -2147467263), None)

I guess in English that would be

pywintypes.com_error: (-2147352567, 'Exception occured.', (4096, 'Microsoft Outlook', 'An error occured. MAPI-error-code: 80004001', None, 0, -2147467263), None)

This error occurs right at the beginning of my script when I try to execute

# imports
import win32com
import win32com.client
import datetime

Outlook = win32com.client.Dispatch("Outlook.Application")
ns = Outlook.GetNamespace("MAPI")
# connect to the shared calendar
recipient = ns.createRecipient(acc) # change to mail you want to get appointments from
resolved = recipient.Resolve()
appointments = ns.GetSharedDefaultFolder(recipient, 9).Items

I have no idea why ns.GetSharedDefaultFolder(recipient, 9).Items throws this error out of nowhere. Any tips?

1
The error is E_NOTIMPL (does not make much sense). Can the folder be accessed from Outlook in the same profile? - Dmitry Streblechenko
Inside of Outlook I can amend and create calendar entries for both calendars. They are also added as delegate stores. - MajinBoo
What do you specify for acc variable? After you call recipient.Resolve, what is the value of recipient.AddressEntry.Type? - Dmitry Streblechenko
The acc variable is the email address and therefor the account name. The value of recipient.AddressEntry.Type is "EX" for both mail accounts. - MajinBoo

1 Answers

0
votes

First of all, add the Logon method before accessing MAPI, it will log to the profile if Outlook has just been started. If it is already running it will not affect anything. Then try to add both mailboxes as delegate stores (see the Advanced tab of the Exchange account properties dialog). You should see both mailboxes.

Use the Resolve method and then check out the returned value. Is it true?

Finally, I'd recommend checking the recipient's name.