exchangelib.services.unsubscribe API documentation

# Module `exchangelib.services.unsubscribe`

Expand source code

    from .common import EWSAccountService, add_xml_child
    from ..util import create_element

    class Unsubscribe(EWSAccountService):
        """Unsubscribing is only valid for pull and streaming notifications.

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

        SERVICE_NAME = 'Unsubscribe'
        returns_elements = False

        def call(self, subscription_id):
            return self._get_elements(payload=self.get_payload(subscription_id=subscription_id))

        def get_payload(self, subscription_id):
            unsubscribe = create_element('m:%s' % self.SERVICE_NAME)
            add_xml_child(unsubscribe, 'm:SubscriptionId', subscription_id)
            return unsubscribe

## Classes

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

  Unsubscribing is only valid for pull and streaming notifications.

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

  Expand source code

      class Unsubscribe(EWSAccountService):
          """Unsubscribing is only valid for pull and streaming notifications.

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

          SERVICE_NAME = 'Unsubscribe'
          returns_elements = False

          def call(self, subscription_id):
              return self._get_elements(payload=self.get_payload(subscription_id=subscription_id))

          def get_payload(self, subscription_id):
              unsubscribe = create_element('m:%s' % self.SERVICE_NAME)
              add_xml_child(unsubscribe, 'm:SubscriptionId', subscription_id)
              return unsubscribe

  ### Ancestors

  - EWSAccountService
  - EWSService

  ### Class variables

  `var SERVICE_NAME`
  `var returns_elements`

  ### Methods

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

        def call(self, subscription_id):
            return self._get_elements(payload=self.get_payload(subscription_id=subscription_id))

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

        def get_payload(self, subscription_id):
            unsubscribe = create_element('m:%s' % self.SERVICE_NAME)
            add_xml_child(unsubscribe, 'm:SubscriptionId', subscription_id)
            return unsubscribe

  ### Inherited members

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