Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full name for API version is unknown for Exchange 2019 #1210

Closed
ostolero opened this issue Jun 19, 2023 · 1 comment
Closed

Full name for API version is unknown for Exchange 2019 #1210

ostolero opened this issue Jun 19, 2023 · 1 comment

Comments

@ostolero
Copy link

Describe the bug
When trying to connect to our EWS Exchange 2019 server, we came across this error-
ValueError: Full name for API version Exchange2016 build 15.2.1118.26 is unknown
This error only appears when running in debug mode , which makes sense as it comes from a log.debug() statement.
After some research, we saw the behavior where Exchange 2019 servers only connect when identifying with other versions (like 2016) has been occurring for other users as well (#927)
We saw in the code there is a retry mechanism to connect with different versions, so our connection is successful with 2016, making this error not exactly align with the methodology.

Full stack trace (without our initial internal code call) -

  File "/usr/local/lib/python3.10/site-packages/exchangelib/services/common.py", line 308, in _get_elements
    yield from self._response_generator(payload=payload)
  File "/usr/local/lib/python3.10/site-packages/exchangelib/services/common.py", line 271, in _response_generator
    response = self._get_response_xml(payload=payload)
  File "/usr/local/lib/python3.10/site-packages/exchangelib/services/common.py", line 415, in _get_response_xml
    self._update_api_version(api_version=api_version, header=header, **parse_opts)
  File "/usr/local/lib/python3.10/site-packages/exchangelib/services/common.py", line 462, in _update_api_version
    log.debug("Found new version (%s -> %s)", self._version_hint, head_version)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1465, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1624, in _log
    self.handle(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1634, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 968, in handle
    self.emit(record)
  File "<string>", line 8502, in emit
  File "/usr/local/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/usr/local/lib/python3.10/logging/__init__.py", line 678, in format
    record.message = record.getMessage()
  File "/usr/local/lib/python3.10/logging/__init__.py", line 368, in getMessage
    msg = msg % self.args
  File "/usr/local/lib/python3.10/site-packages/exchangelib/version.py", line 269, in __str__
    return f"Build={self.build}, API={self.api_version}, Fullname={self.fullname}"
  File "/usr/local/lib/python3.10/site-packages/exchangelib/version.py", line 173, in fullname
    raise ValueError(f"Full name for API version {self.api_version} build {self.build} is unknown")
ValueError: Full name for API version Exchange2016 build 15.2.1118.26 is unknown

I'm using Exchangelib 5.0.2 and python 3
If anyone comes across this and needs a patch - overriding the fullname function in the following manner removes the error-

from exchangelib.version import VERSIONS as EXC_VERSIONS

def our_fullname(self):
    for build, api_version, full_name in EXC_VERSIONS:
        if self.build:
            if self.build.major_version != build.major_version:
                continue
        if self.api_version == api_version:
            return full_name

Version.fullname = our_fullname
@ecederstrand
Copy link
Owner

I can't find any authoritative information pointing to the correct API version value of Exchange 2019, but it seems that it should in fact be Exchange2016, not 2019: https://learn.microsoft.com/en-us/answers/questions/422876/what-is-the-verson-value-for-exchange2019-in-reque

We only use Version.fullname for informational purposes. I don't think it should throw errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants