win32com.client (Howto edit Contacts in Outlook)
mail at timgolden.me.uk
Fri Jul 4 15:24:36 CEST 2008
Bill Davy wrote:
> I am trying to edit Contacts in Outlook. This is so I can transfer numbers
> from my address book which is an Excel spreadsheet to my mobile phone. I
> came across the following snippet of code
--- hey! that looks familiar :)
> which enabled me to the contacts
> at least list. I had to root around to discover CdoDefaultFolderContacts
> (though it was guessable; how could I enumerate win32com.client.constants?).
Well that bit's easy: win32com.client.constants is a small class with
a __dicts__ attribute (note the "s") which is a list of dictionaries, one
per generated library. So you can do something like this:
outlook = win32com.client.gencache.EnsureDispatch ("Outlook.Application")
outlook_constants = win32com.client.constants.__dicts__
for k, v in outlook_constants.items ():
print k, "=>", v
> I now want to work through the Contacts in Outlook patching in data from my
> spreadsheet, and also making new contacts where there is an entry in my
> spreadsheet which has not gone into Contacts already.
> Where can I find the API?
More information about the Python-list