Skip to content

Commit

Permalink
fix: Support extra attributes of QueryString
Browse files Browse the repository at this point in the history
  • Loading branch information
ecederstrand committed Jan 21, 2025
1 parent fd6cee6 commit 7a00a2b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions exchangelib/restriction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .errors import InvalidEnumValue
from .fields import DateTimeBackedDateField, FieldPath, InvalidField
from .util import create_element, is_iterable, value_to_xml_text, xml_to_str
from .version import EXCHANGE_2010
from .version import EXCHANGE_2010, EXCHANGE_2013

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -346,7 +346,12 @@ def to_xml(self, folders, version, applies_to):
self._check_integrity()
if version.build < EXCHANGE_2010:
raise NotImplementedError("QueryString filtering is only supported for Exchange 2010 servers and later")
elem = create_element("m:QueryString")
if version.build < EXCHANGE_2013:
elem = create_element("m:QueryString")
else:
elem = create_element(
"m:QueryString", attrs=dict(ResetCache=True, ReturnDeletedItems=False, ReturnHighlightTerms=False)
)
elem.text = self.query_string
return elem
# Translate this Q object to a valid Restriction XML tree
Expand Down

0 comments on commit 7a00a2b

Please sign in to comment.