Skip to content

Commit

Permalink
fix: move _distinguished_id wiping into the from_xml_with_root method.
Browse files Browse the repository at this point in the history
…Fixes #1301
  • Loading branch information
ecederstrand committed May 13, 2024
1 parent fbb8c45 commit 17ea29a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions exchangelib/folders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,8 @@ def from_xml_with_root(cls, elem, root):
)
if folder_cls == Folder:
log.debug("Fallback to class Folder (folder_class %s, name %s)", folder.folder_class, folder.name)
# Some servers return folders in a FindFolder result that have a DistinguishedFolderId element that the same
# server cannot handle in a GetFolder request. Only set the DistinguishedFolderId field if we recognize the ID.
if folder._distinguished_id and not folder_cls.DISTINGUISHED_FOLDER_ID:
folder._distinguished_id = None
return folder_cls(root=root, **{f.name: getattr(folder, f.name) for f in folder.FIELDS})
4 changes: 0 additions & 4 deletions exchangelib/services/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,4 @@ def parse_folder_elem(elem, folder):
# Not all servers support fetching the DistinguishedFolderId field. Add it back here.
if folder._distinguished_id and not res._distinguished_id:
res._distinguished_id = folder._distinguished_id
# Some servers return folders in a FindFolder result that have a DistinguishedFolderId element that the same server
# cannot handle in a GetFolder request. Only set the DistinguishedFolderId field if we recognize the ID.
elif res._distinguished_id and not folder.DISTINGUISHED_FOLDER_ID:
res._distinguished_id = None
return res

0 comments on commit 17ea29a

Please sign in to comment.