exchangelib.services.get_server_time_zones API documentation

# Module `exchangelib.services.get_server_time_zones`

## Classes

`class GetServerTimeZones (protocol, chunk_size=None, timeout=None)`
  Expand source code

      class GetServerTimeZones(EWSService):
          """MSDN:
          https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/getservertimezones-operation
          """

          SERVICE_NAME = "GetServerTimeZones"
          element_container_name = f"{{{MNS}}}TimeZoneDefinitions"
          supported_from = EXCHANGE_2010

          def call(self, timezones=None, return_full_timezone_data=False):
              return self._elems_to_objs(
                  self._get_elements(
                      payload=self.get_payload(timezones=timezones, return_full_timezone_data=return_full_timezone_data)
                  )
              )

          def get_payload(self, timezones, return_full_timezone_data):
              payload = create_element(
                  f"m:{self.SERVICE_NAME}",
                  attrs=dict(ReturnFullTimeZoneData=return_full_timezone_data),
              )
              if timezones is not None:
                  is_empty, timezones = peek(timezones)
                  if not is_empty:
                      tz_ids = create_element("m:Ids")
                      for timezone in timezones:
                          tz_id = set_xml_value(create_element("t:Id"), timezone.ms_id)
                          tz_ids.append(tz_id)
                      payload.append(tz_ids)
              return payload

          def _elem_to_obj(self, elem):
              return TimeZoneDefinition.from_xml(elem=elem, account=None)

  MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/getservertimezones-operation

  ### Ancestors

  - EWSService
  - SupportedVersionClassMixIn

  ### Methods

  `def call(self, timezones=None, return_full_timezone_data=False)`
    Expand source code

        def call(self, timezones=None, return_full_timezone_data=False):
            return self._elems_to_objs(
                self._get_elements(
                    payload=self.get_payload(timezones=timezones, return_full_timezone_data=return_full_timezone_data)
                )
            )

  `def get_payload(self, timezones, return_full_timezone_data)`
    Expand source code

        def get_payload(self, timezones, return_full_timezone_data):
            payload = create_element(
                f"m:{self.SERVICE_NAME}",
                attrs=dict(ReturnFullTimeZoneData=return_full_timezone_data),
            )
            if timezones is not None:
                is_empty, timezones = peek(timezones)
                if not is_empty:
                    tz_ids = create_element("m:Ids")
                    for timezone in timezones:
                        tz_id = set_xml_value(create_element("t:Id"), timezone.ms_id)
                        tz_ids.append(tz_id)
                    payload.append(tz_ids)
            return payload

  ### Inherited members

  - `EWSService`:
    - `CHUNK_SIZE`
    - `ERRORS_TO_CATCH_IN_RESPONSE`
    - `NO_VALID_SERVER_VERSIONS`
    - `NS_MAP`
    - `SERVICE_NAME`
    - `WARNINGS_TO_CATCH_IN_RESPONSE`
    - `WARNINGS_TO_IGNORE_IN_RESPONSE`
    - `deprecated_from`
    - `element_container_name`
    - `get`
    - `parse`
    - `returns_elements`
    - `supported_api_versions`
    - `supported_from`
    - `wrap`