Skip to content
Discussion options

You must be logged in to vote

Categories is actually defined on the base Item class (item:Categories in EWS), not on Message specifically. So Contact inherits it the same way Message, CalendarItem, and Task do. You should already be able to access it as a plain attribute:

for contact in account.contacts.all():
    print(contact.name, contact.categories)

categories comes back as a list of strings (it's backed by exchangelib's CharListField), or None if no categories are assigned.
If you're not seeing it, the most likely cause is that you are restricting the fields being fetched, via .only(...) on the queryset, or a custom additional_fields for fetch and categories just isn't in that list. Double check with:

contact = a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ms777
Comment options

Answer selected by ecederstrand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants