exchangelib.services.export_items API documentation

# Module `exchangelib.services.export_items`

Expand source code

    from .common import EWSAccountService, create_item_ids_element
    from ..errors import ResponseMessageError
    from ..util import create_element, MNS

    class ExportItems(EWSAccountService):
        """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/exportitems-operation"""

        ERRORS_TO_CATCH_IN_RESPONSE = ResponseMessageError
        SERVICE_NAME = 'ExportItems'
        element_container_name = '{%s}Data' % MNS

        def call(self, items):
            return self._elems_to_objs(self._chunked_get_elements(self.get_payload, items=items))

        def _elems_to_objs(self, elems):
            for elem in elems:
                if isinstance(elem, Exception):
                    yield elem
                    continue
                yield elem.text  # All we want is the 64bit string in the 'Data' tag

        def get_payload(self, items):
            exportitems = create_element('m:%s' % self.SERVICE_NAME)
            item_ids = create_item_ids_element(items=items, version=self.account.version)
            exportitems.append(item_ids)
            return exportitems

        # We need to override this since ExportItemsResponseMessage is formatted a
        # little bit differently. .
        @classmethod
        def _get_elements_in_container(cls, container):
            return [container]

## Classes

`class ExportItems (*args, **kwargs)`

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

  Expand source code

      class ExportItems(EWSAccountService):
          """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/exportitems-operation"""

          ERRORS_TO_CATCH_IN_RESPONSE = ResponseMessageError
          SERVICE_NAME = 'ExportItems'
          element_container_name = '{%s}Data' % MNS

          def call(self, items):
              return self._elems_to_objs(self._chunked_get_elements(self.get_payload, items=items))

          def _elems_to_objs(self, elems):
              for elem in elems:
                  if isinstance(elem, Exception):
                      yield elem
                      continue
                  yield elem.text  # All we want is the 64bit string in the 'Data' tag

          def get_payload(self, items):
              exportitems = create_element('m:%s' % self.SERVICE_NAME)
              item_ids = create_item_ids_element(items=items, version=self.account.version)
              exportitems.append(item_ids)
              return exportitems

          # We need to override this since ExportItemsResponseMessage is formatted a
          # little bit differently. .
          @classmethod
          def _get_elements_in_container(cls, container):
              return [container]

  ### Ancestors

  - EWSAccountService
  - EWSService

  ### Class variables

  `var ERRORS_TO_CATCH_IN_RESPONSE`

    Global error type within this module.

  `var SERVICE_NAME`
  `var element_container_name`

  ### Methods

  `def call(self, items)`
    Expand source code

        def call(self, items):
            return self._elems_to_objs(self._chunked_get_elements(self.get_payload, items=items))

  `def get_payload(self, items)`
    Expand source code

        def get_payload(self, items):
            exportitems = create_element('m:%s' % self.SERVICE_NAME)
            item_ids = create_item_ids_element(items=items, version=self.account.version)
            exportitems.append(item_ids)
            return exportitems

  ### Inherited members

  - `EWSAccountService`:
    - `NO_VALID_SERVER_VERSIONS`
    - `WARNINGS_TO_CATCH_IN_RESPONSE`
    - `get`
    - `parse`