[Spambayes] Outlook plugin & bad folders

Meyer, Tony T.A.Meyer at massey.ac.nz
Wed Jan 15 15:43:15 EST 2003


I've had a trouble with the Outlook plugin in that whenever it tries to build a folder list (i.e. in the various dialogs) an exception is raised and the list presented is empty.  I traced it to a bad folder (Outlook can't display it either).

Now, normally, one should fix the cause, not the effect, but in this case the folder is on an exchange server and is not mine (it's a public folder).  Getting the owner of the folder to fix things would be very difficult.

So I altered FolderSelector.py so that if a bad folder causes this sort of problem, it's simply not presented in the list (but all the other folders are).

Probably not all that important, but it does (in most ways) make it more user-friendly.  Anyway, here's the new function in case you want to alter the cvs to reflect it.  I've never used Python before, so this may not be the best way to do this (suggestions of better ways are welcome, obviously).

import pywintypes
def _BuildFolderTreeOutlook(session, parent):
    children = []
    for i in range(parent.Folders.Count):
        folder = parent.Folders[i+1]
            spec = FolderSpec((folder.StoreID, folder.EntryID),
                          folder.Name.encode("mbcs", "replace"))
            if folder.Folders:
                spec.children = _BuildFolderTreeOutlook(session, folder)
        except pywintypes.com_error:
            print "Skipping folder " + folder.Name
    return children

=Tony Meyer

More information about the Spambayes mailing list