Registering a COM object in Python

Florian Reiser florian.reiser at ra-bc.de
Fri Oct 31 14:01:00 EST 2003


Hi Fernando,

generate the definition file for Outlook with the gen_py utility.
After that, try the following code:

import win32com.client
outlookObject = win32com.client.Dispatch("Outlook.View")

then do anything you want on outlookObject. After that release outlookObject
with del outlookObject.

Greets
Florian

"Fernando Gabrieli" <fgabrieli at extrabold.com> schrieb im Newsbeitrag
news:3b530e51.0310310934.b352bec at posting.google.com...
> I need to call Outlook COM methods from Python
>
> Thanks for answering :)
>
> Bye,
> Fernando
>
> "Florian Reiser" <florian.reiser at ra-bc.de> wrote in message
news:<bnt06n$maa$1 at online.de>...
> > Hi Fernando,
> >
> > do you want to call your python class from outlook, or outlook from your
> > python class?
> >
> > Greets
> > Florian
> >
> > "Fernando Gabrieli" <fgabrieli at extrabold.com> schrieb im Newsbeitrag
> > news:3b530e51.0310301427.54a90d49 at posting.google.com...
> > > I need to communicate with Outlook 2000 COM object using win32com in
> >  Python.
> > >
> > > I registered a new class and called
> > >
> > >     win32com.server.register.UseCommandLine(OutlookAddin)
> > >
> > > using this for OutlookAddin
> > >
> > > class OutlookAddin:
> > >    _com_interfaces_ = ['_IDTExtensibility2']
> > >     _public_methods_ = ['alive']
> > >     _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER
> > >     _reg_clsid_ = "{16925498-0E7D-4d7f-A26B-825D994FBCBC}"
> > >     _reg_progid_ = "Test.OutlookAddin"
> > >
> > > Also ive defined OnConnection and other events but they NEVER get
called
> > >
> > > Somebody knows what is happening ?
> > >
> > > Thanks,
> > > Fernando






More information about the Python-list mailing list