Python and MAPI

Grant Edwards grant at nowhere.
Tue Jan 18 16:55:00 EST 2000


In article <387DF8C4.4B3214CE at netscape.com>, Michel Orengo wrote:

>I've just started to play around with MAPI. I'm far from being a expert but here
>is a sample of what you can do to send a message:
>
>import win32com.client
>session = win32com.client.Dispatch("MAPI.Session")
>session.Logon("Michel Orengo")
>outbox=session.Outbox
>collmsg=outbox.Messages
>msgo=collmsg.Add("my subject","my
>text",win32com.mapi.mapitags.PR_MESSAGE_CLASS,1)
>msgo.Recipients.Add("Michel","morengo at morganlabs.com")
>msgo.Sender.Address="morganea at bellatlantic.net"
>msgo.Send(1,0)

Here's the code I ended up trying to run:

------------------------------------------------------------
import win32com.client
import win32com.mapi.mapitags

session = win32com.client.Dispatch("MAPI.Session")
session.Logon("MS Exchange Settings")
outbox=session.Outbox
collmsg=outbox.Messages
msgo=collmsg.Add("subj text","message text",win32com.mapi.mapitags.PR_MESSAGE_CLASS,1)
msgo.Recipients.Add("grante at visi.com")
msgo.Sender.Address="grant.edwards at comtrol.com"
msgo.Send(1,0)
session.Logoff
------------------------------------------------------------

It bombs at line msgo.Sender.Address="" line with the following
error:

com_error: (-2147221233, 'OLE error 0x8004010f', (1271, 'Collaboration Data Objects', ' [Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]', None, 0, -2147221233), None)

I'm a complete newbie when it comes to win32 programming, so if
somebody could lend me a pointer, I'd appreciate it.

PS: Once I get the above example to work, what I _really_ want
    to do is to retreive messages from my inbox, but I can't
    figure out what operations are avaiable for mapi objects.
    
    Any pointers in that respect?
    

-- 
Grant Edwards                   grante             Yow!  Do you need
                                  at               any MOUTH-TO-MOUTH
                               visi.com            resuscitation?



More information about the Python-list mailing list