Skip to content

Commit

Permalink
Merge pull request #88 from nylas/incident-20230412-elevated-504s-fro…
Browse files Browse the repository at this point in the history
…m-exchange-server-when-sending

Fixing for CH53323
  • Loading branch information
pengfeiye authored Apr 13, 2023
2 parents bd80fd4 + 7118618 commit cefbcd9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions exchangelib/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,13 @@ def get_default_folder(self, folder_cls):
# folder was found, try as best we can to return the default folder of type 'folder_cls'
if not folder_cls.DISTINGUISHED_FOLDER_ID:
raise ValueError("'folder_cls' %s must have a DISTINGUISHED_FOLDER_ID value" % folder_cls)

for f in self._folders_map.values():
# Require exact class, to not match subclasses, e.g. RecipientCache instead of Contacts
if f.__class__ == folder_cls and f.is_distinguished:
log.debug('Found cached distinguished %s folder', folder_cls)
return f
if self._subfolders is not None:
for f in self._folders_map.values():
# Require exact class, to not match subclasses, e.g. RecipientCache instead of Contacts
if f.__class__ == folder_cls and f.is_distinguished:
log.debug('Found cached distinguished %s folder', folder_cls)
return f

try:
log.debug('Requesting distinguished %s folder explicitly', folder_cls)
return folder_cls.get_distinguished(account=self.account)
Expand Down

0 comments on commit cefbcd9

Please sign in to comment.