[python-win32] getting global addressbook with extended mapi

Mark Hammond mhammond at skippinet.com.au
Wed Jun 8 00:48:29 CEST 2005


> Hi Mark,
>
> can you please give me some more instructions ?

Not in any detail as I don't have an exchange server to test against.

> restriction = (mapi.RES_CONTENT,   # a property restriction
>                        (mapi.FL_SUBSTRING | mapi.FL_IGNORECASE |
> mapi.FL_LOOSE, # fuzz level
>                         PR_DISPLAY_TYPE,   # of the given prop
>                         (PR_DISPLAY_TYPE, 'DT_GLOBAL'))) #
> with given val
> rows = mapi.HrQueryAllRows(con_list,
>                                    (PR_ENTRYID, PR_DISPLAY_TYPE),   #
> columns to retrieve
>                                    restriction,     # only these rows
>                                    None,            # any
> sort order is fine
>                                    0)
> </my code>
>
> results in: TypeError: an integer is required. If I change
> 'DT_GLOBAL'
> to an integer, rows is empty.

PR_DISPLAY_TYPE is indeed an integer.

>>> from win32com.mapi import mapitags
>>> mapitags.PROP_TYPE(mapitags.PR_DISPLAY_TYPE)
3
>>> mapitags.PT_LONG
3

Why not change your code to remove that restriction, then dump all records
found - that should allow you see what values are actually in there.

> but I'm unable to adapt that in python.

Why?  Is something missing, or it just tricky?

Sadly, if you want easy, you use CDO/Simple MAPI.  Extended MAPI is not for
the faint hearted (or for people with deadlines :)

Mark



More information about the Python-win32 mailing list