exchangelib.services.mark_as_junk API documentation

# Module `exchangelib.services.mark_as_junk`

## Classes

`class MarkAsJunk (*args, **kwargs)`
  Expand source code

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

          SERVICE_NAME = "MarkAsJunk"

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

          def _elem_to_obj(self, elem):
              return MovedItemId.id_from_xml(elem)

          @classmethod
          def _get_elements_in_container(cls, container):
              return container.findall(MovedItemId.response_tag())

          def get_payload(self, items, is_junk, move_item):
              # Takes a list of items and returns either success or raises an error message
              payload = create_element(f"m:{self.SERVICE_NAME}", attrs=dict(IsJunk=is_junk, MoveItem=move_item))
              payload.append(item_ids_element(items=items, version=self.account.version))
              return payload

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

  ### Ancestors

  - EWSAccountService
  - EWSService
  - SupportedVersionClassMixIn

  ### Class variables

  `var SERVICE_NAME`

  ### Methods

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

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

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

        def get_payload(self, items, is_junk, move_item):
            # Takes a list of items and returns either success or raises an error message
            payload = create_element(f"m:{self.SERVICE_NAME}", attrs=dict(IsJunk=is_junk, MoveItem=move_item))
            payload.append(item_ids_element(items=items, version=self.account.version))
            return payload

  ### Inherited members

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