2

I am using exchangelib to script over my exchange email service. I can search email within various folders. I can search contact within some contact folders as well. However, I cannot find a way to search contact over the full Active Directory or Address Book seen in outlook application.

Below is a list of folder shown via exchange lib:

├── Top of Information Store
│   ├── Archive
│   ├── Calendar
│   │   └── Birthdays
│   ├── Contacts
│   │   ├── Companies
│   │   ├── GAL Contacts
│   │   ├── Organizational Contacts
│   │   ├── PeopleCentricConversation Buddies
│   │   ├── Recipient Cache
│   │   ├── {06967759-274D-40B2-A3EB-D7F9E73727D7}
│   │   └── {A9E2BC46-B3A0-4243-B315-60D991004455}

The "Organisational Contacts" folder is empty:

>>> print((account.contacts / "Organizational Contacts").total_count)
0

Any one has every managed to do that?

nngeek
  • 1,912
  • 16
  • 24
  • Does `GAL Contacts` work for you? It could also be that `total_count` is misleading. What does `(account.contacts / "Organizational Contacts").count()` say? – Erik Cederstrand Nov 22 '19 at 10:28
  • @ErikCederstrand `.count()` gives error saying `AttributeError: 'Folder' object has no attribute 'count'` GAL Contacts also empty. I even tried to loop `account.contacts.all()` It only contains all the contacts having activity with me recently. Not the full Address Book. – nngeek Nov 25 '19 at 03:00
  • Sorry, should have been `(account.contacts / "Organizational Contacts").all().count()` – Erik Cederstrand Nov 25 '19 at 06:21
  • @ErikCederstrand `.all().count()` still shows `0` . As i said, i looped `account.contacts.all()` still no hope. I guess `Address Book` is actually `Active Directory` service which may require separate connection or library. – nngeek Nov 25 '19 at 07:02
  • Have the same issue, cannot fetch GAL or Organization contacts. ` contact = gal.get(email_addresses=EmailAddress(email='xyz@company.domain')) ... /exchangelib/queryset.py", line 532, in get raise DoesNotExist() exchangelib.errors.DoesNotExist` – Deepak V Apr 29 '21 at 11:43

0 Answers0