[python-win32] getting email adresses from outlook

Jürgen Kareta python at kareta.de
Tue May 31 15:20:49 CEST 2005


Steve Holden schrieb:

> Jürgen Kareta wrote:
>
>> Hello,
>>
>> I'm trying to get some email addresses with the following pythoncode:
>>
>> import win32com.client
>> O = win32com.client.gencache.EnsureDispatch('Outlook.Application')
>> mapi=O.GetNamespace('MAPI')
>> adr_li=mapi.AddressLists.Item('Global Addressbook')
>> members=adr_li.AddressEntries.Item('MyGroup').Members
>> for num in range(0, members.__len__()-1):
>>     name=entr.GetNext()
>>     print name.Name,name.Address
>>
> entr.GetNext? Is it possible you aren't dealing with what you think 
> you are dealing with? Don't see any other reference to this in your code.

sorry, entr.GetNext should be members.GetNext

name=
'<win32com.gen_py.Microsoft Outlook 9.0 Object Library.AddressEntry 
instance at 0x20713680> '

dir(name) =
 ['CLSID', 'Delete', 'Details', 'GetFreeBusy', 'Update', 
'UpdateFreeBusy', '_ApplyTypes_', '__cmp__', '__doc__', '__getattr__', 
'__init__', '__module__', '__repr__', '__setattr__', 
'_get_good_object_', '_get_good_single_object_', '_oleobj_', 
'_prop_map_get_', '_prop_map_put_', 'coclass_clsid']

name._prop_map_get_ =
{'Name': (12289, 2, (8, 0), (), 'Name', None),
'Parent': (61441, 2, (9, 0), (), 'Parent', None),
'DisplayType': (14592, 2, (3, 0), (), 'DisplayType', None),
 'MAPIOBJECT': (61696, 2, (13, 0), (), 'MAPIOBJECT', None),
 'Class': (61450, 2, (3, 0), (), 'Class', None),
'Application': (61440, 2, (9, 0), (), 'Application', 
'{00063001-0000-0000-C000-000000000046}'),
 'Manager': (771, 2, (9, 0), (), 'Manager', 
'{0006304B-0000-0000-C000-000000000046}'),
 'Session': (61451, 2, (9, 0), (), 'Session', 
'{00063002-0000-0000-C000-000000000046}'),
'Members': (772, 2, (9, 0), (), 'Members', 
'{0006304A-0000-0000-C000-000000000046}'),
'Address': (12291, 2, (8, 0), (), 'Address', None),
'Type': (12290, 2, (8, 0), (), 'Type', None),
 'ID': (61470, 2, (8, 0), (), 'ID', None)}

I found  an example on the net for reading/writing contacts with python. 
There is a property  'AddressType' with value 'SMTP'
available. But here, I can't found anything similar.

regards,
Jürgen


More information about the Python-win32 mailing list