COM Method/Property access

Stefan Migowsky smigowsky at
Wed May 3 13:47:47 CEST 2000


the "Forward" method is called as a property since you are
using dynamic dispatch. The caller (PythonCOM) doesn't know
anything about the method except the name. With the name 
it figures out the parameters for the dispatch COM call. 

Since the are four types for one the parameter :

PropertyPut, PropertyGet, PropertyPutRef, Method

it tries first in your case "PropertyGet" which succeeds
since there are no parameters for the "Forward" method. 
Any subsequent call will always assume that you try to get 
a property.

With a proper typelib you don't have that problem since 
pythoncom must not guess because it has all information.
If you have a typelib try to generate the wrapper with 
"makepy" and you can call the function as a function. 


>-----Original Message-----
>From: nikolai.kirsebom at [mailto:nikolai.kirsebom at]
>Sent: Wednesday, May 03, 2000 9:11 AM
>To: python-list at
>Subject: COM Method/Property access
>I'm using Python as COM client with Outlook 97 as the server.  In the
>documentation on Outlook, a received mail item has the method
>'Forward', which according makes a new mail item which may be
>forwarded to another recepient (like pressing the forward button in
>outlook 97).
>I've noticed that I have to use the following syntax to get this to
>fwdItem = mailItem.Forward
>fwdItem.To = "someone at world"
>Since forward is a method I would have expected the following syntax
>to be the correct one:
>fwdItem = mailItem.Forward()
>Can anyone explain why the 'method' should be called without the

More information about the Python-list mailing list