Search code examples
pythonoutlookoutlook-restapi

what is the API for Conversation history folder in outlook?


I am trying to create python script to read and process conversation history folder in outlook.

Where can I get a Conversation history API for it?

outlook.GetDefaultFolder() does not have conversation history index as per the Microsoft website.

Is there any other approach to read the items in a conversation history?


Solution

  • It should be there but its listed as "Conversation Action Settings".

    Try running the following python script and see if it comes up for you.

    from win32com.client.gencache import EnsureDispatch as Dispatch
    outlook = Dispatch("Outlook.Application")
    mapi = outlook.GetNamespace("MAPI")
    
    class Dummy():
        def __init__(self, outlook_object):
            self._obj = outlook_object
    
        def items(self):
            array_size = self._obj.Count
            for item_index in range(1,array_size+1):
                yield (item_index, self._obj[item_index])
    
        def prop(self):
            return sorted( self._obj._prop_map_get_.keys() )
    
    for _, folder in Dummy(mapi.Folders).items():
        print(folder.Name)
        for inx,subfolder in Dummy(folder.Folders).items():
            print(subfolder.Name)