the thpinfo.com blogger archives (2007-2008)
Minimalistic Evolution phonebook extractor
Published: 2007-08-22T15:10:00.000+02:00
Tags: econtact, gobject, contacts, python, evolution, ebook
If you're using Evolution as your E-Mail client and contact management application, and you like Python, here is a small snippet that allows you to dump out all phone numbers of your contacts to the console. Of course, with this code as a guide, you can produce even more useful applications ;)
What you need: Evolution, pygobject, evolution-python, Python (2.4 or higher) and some contacts in your contact list
#!/usr/bin/python
import evolution
import gobject
book = evolution.open_addressbook('default')
props = gobject.list_properties( evolution.EContact)
pp = [ p.name for p in props if 'phone' in p.name ]
for contact in book.get_all_contacts():
gp = contact.get_property
name = gp('file-as')
numbers = ', '.join( [ gp(p) for p in pp if gp(p) ])
if numbers:
print ': '.join( [ name, numbers ])
Comments
Thomas Perl (2007-10-13T16:33:00.000+02:00)
I'm now using an improved version of this code in smpy, which can be found here: http://thpinfo.com/2007/hacks/#smpy
Dernalis (2007-09-07T15:38:00.000+02:00)
Nice guide, thanks a lot....
but I'm going crazy to get data from GParamBoxed data like 'birth-date'
could you add some stuff like this to source code?
Thomas Perl (thp at this domain); jabber: thp@jabber.org