[python-win32] WABAccess help ...

Clinton Lee Taylor clintonlee.taylor at gmail.com
Wed Mar 12 22:28:26 CET 2008


Sorry ... JFYI ... How to dump all contacts in the Windows Address Book ... ;-)

>  Spend a whole night, with the following code, but can only put stuff
>  into the WAB, not get a list of e-mail address ...

 Really simple to dump all the contacts ...

import win32com.client

objSession = win32com.client.gencache.EnsureDispatch("WABAccess.Session")

print objSession

objSession.Open(False)

if objSession.Identities.LastIdentity ==
"{00000000-0000-0000-0000-000000000000}":
    print "No Identity Selected"
else:
    print "The Identity " +
objSession.Identities(objSession.Identities.LastIdentity).Name + " is
selected"

print objSession.Identities.DefaultIdentity
print objSession.Identities.Count

print objSession.Containers.Count

for oCont in objSession.Containers:
    for oItem in oCont.Elements:
        print oItem.Name


objSession.Refresh

objSession.Close
print "Done."

Now to figure how to get only contacts with fax numbers and print the
name and fax number ...

Thanks
Mailed
LeeT


More information about the python-win32 mailing list