Ok. I'll take that as good news.

I have been able to reproduce this exception through the IDE debugger by just 
running msgstore.py by itself. It appears that the call to MAPIMsgStore 
constructor (in function test) is returning successfully, and it looks like 
valid data. The exception happens on the next line, in the 
store.GetFolderGenerator function. I can't seem to generate a valid folder 
(store_id and entry_id tuple). The store_id and entry_id are strings. Are they 
supposed to be encoded as something else in Python3 in order to work with 
pywin32 and mapi? Byte strings don't seem to work. The call originally had 
mapi.BinFromHex in NormalizeId, but that doesn't seem to work with Python 
strings, or byte strings. Because NormalizeId isn't generating something 
useful, the call to _OpenEntry a few lines later, which calls _GetMessageStore, 
which calls session.OpenMsgStore, fails.

I'm not familiar enough with this Outlook Add Ins or the pywin32 library to 
guess a next step. Could this be a permissions issue? I'd like to think not, 
since the 32 bit version of Outlook works with Spambayes, and, with the 64 bit 
version of Outlook, the MAPILogonEx call seems to work.

jwc
From: Mark Hammond <mhamm...@skippinet.com.au>
Sent: Thursday, December 14, 2023 11:29 AM
To: John Cherney <jwcher...@hotmail.com>; spambayes-dev@python.org
Subject: Re: [spambayes-dev] Any thoughts on this exception?


That exception looks more like we can't access the message store rather than a 
64/32 bit mismatch. It may be that you need to enable MAPI access or something 
similar but I'm afraid I've never used newer versions of office. Googling for 
MAPI_E_INVALID_ENTRYID with Office 365 is probably the best path forward.

Cheers,

Mark
On 2023-12-13 11:37 p.m., John Cherney wrote:
I've made some progress. I've cloned smontanaro's spambayes repo and used that 
as a starting point. I think I've gotten most, of the 2.x to 3.x conversions. I 
have the Add-in registered. I have the Add-ins menu showing up. But (and there 
has to be a 'but') I can't seem to get the win32com mapi to read anything 
meaningful. I haven't seen anything helpful in my Google searches. I'm throwing 
this out there hoping that someone has seen something like this and can get me 
unstuck.

Loaded bayes database from 'C:\<redacted>\default_bayes_database.fs'
Loaded message database from 'C:\<redacted>\default_message_database.fs'
Bayes database initialized with 0 spam and 0 good messages
SpamBayes Outlook Addin Version 2.0a1 (Aug 25, 2022) from source
on Windows 10.0.19045 ()
using Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 
64 bit (AMD64)]
Log created Wed Dec 13 22:53:24 2023
*** SpamBayes is NOT enabled, so will not filter incoming mail. ***
Creating new SpamBayes toolbar to host our buttons
Error finding the MAPI folders for a folder switch event
ERROR: 'There appears to be a problem with the SpamBayes 
configuration\r\n\r\nPlease select the SpamBayes manager, and run 
the\r\nConfiguration Wizard to reconfigure the filter.'
Traceback (most recent call last):
  File "C:\<redacted>\spambayes\Outlook2000\msgstore.py", line 347, in GetFolder
    folder = self._OpenEntry(folder_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<redacted>\spambayes\Outlook2000\msgstore.py", line 274, in 
_OpenEntry
    store = self._GetMessageStore(store_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<redacted>\spambayes\Outlook2000\msgstore.py", line 247, in 
_GetMessageStore
    store = self.session.OpenMsgStore(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147221241, 'OLE error 0x80040107', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\<redacted>\spambayes\Outlook2000\addin.py", line 1178, in 
OnFolderSwitch
    mapi_folder = self.manager.message_store.GetFolder(outlook_folder)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<redacted>\spambayes\Outlook2000\msgstore.py", line 355, in GetFolder
    raise MsgStoreExceptionFromCOMException(details)
msgstore.MsgStoreException: MsgStoreException: Exception 0x-7ffbfef9 
(MAPI_E_INVALID_ENTRYID): OLE error 0x80040107
ERROR: 'There appears to be a problem with the SpamBayes 
configuration\r\n\r\nPlease select the SpamBayes manager, and run 
the\r\nConfiguration Wizard to reconfigure the filter.'

One thing I'm suspicious of (and I hope I'm wrong) is if the problem is the 
win32 related modules. I'm doing this on a 64bit machine, trying to get this to 
work with the 64bit install of Outlook (Office 365). Could that be my problem? 
Should I be looking for win64 related modules? (Do any exist? I didn't see any 
on pypi.org? Or is that also a wrong direction?) At this point, I don't know 
enough about COM or 32bit vs 64bit to know what to try next.

Thanks in advance,
jwc



_______________________________________________

spambayes-dev mailing list

spambayes-dev@python.org<mailto:spambayes-dev@python.org>

https://mail.python.org/mailman/listinfo/spambayes-dev
_______________________________________________
spambayes-dev mailing list
spambayes-dev@python.org
https://mail.python.org/mailman/listinfo/spambayes-dev

Reply via email to