exchangelib.items.post API documentation

# Module `exchangelib.items.post`

Expand source code

    import logging

    from ..fields import BodyField, DateTimeField, MailboxField, TextField
    from .item import Item
    from .message import Message

    log = logging.getLogger(__name__)

    class PostItem(Item):
        """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/postitem"""

        ELEMENT_NAME = "PostItem"

        conversation_index = Message.FIELDS["conversation_index"]
        conversation_topic = Message.FIELDS["conversation_topic"]

        author = Message.FIELDS["author"]
        message_id = Message.FIELDS["message_id"]
        is_read = Message.FIELDS["is_read"]

        posted_time = DateTimeField(field_uri="postitem:PostedTime", is_read_only=True)
        references = TextField(field_uri="message:References")
        sender = MailboxField(field_uri="message:Sender", is_read_only=True, is_read_only_after_send=True)

    class PostReplyItem(Item):
        """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/postreplyitem"""

        ELEMENT_NAME = "PostReplyItem"

        # This element only has Item fields up to, and including, 'culture'
        # TDO: Plus all message fields
        new_body = BodyField(field_uri="NewBodyContent")  # Accepts and returns Body or HTMLBody instances

        culture_idx = Item.FIELDS.index_by_name("culture")
        sender_idx = Message.FIELDS.index_by_name("sender")
        FIELDS = Item.FIELDS[: culture_idx + 1] + Message.FIELDS[sender_idx:]

## Classes

`class PostItem (**kwargs)`

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

  Pick out optional 'account' and 'folder' kwargs, and pass the rest to the parent class.

  :param kwargs: 'account' is optional but allows calling 'send()' and 'delete()' 'folder' is optional but allows calling 'save()'. If 'folder' has an account, and 'account' is not set, we use folder.account.

  Expand source code

      class PostItem(Item):
          """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/postitem"""

          ELEMENT_NAME = "PostItem"

          conversation_index = Message.FIELDS["conversation_index"]
          conversation_topic = Message.FIELDS["conversation_topic"]

          author = Message.FIELDS["author"]
          message_id = Message.FIELDS["message_id"]
          is_read = Message.FIELDS["is_read"]

          posted_time = DateTimeField(field_uri="postitem:PostedTime", is_read_only=True)
          references = TextField(field_uri="message:References")
          sender = MailboxField(field_uri="message:Sender", is_read_only=True, is_read_only_after_send=True)

  ### Ancestors

  - Item
  - BaseItem
  - RegisterMixIn
  - IdChangeKeyMixIn
  - EWSElement

  ### Class variables

  `var ELEMENT_NAME`
  `var FIELDS`

  ### Instance variables

  `var author`
  `var conversation_index`
  `var conversation_topic`
  `var is_read`
  `var message_id`
  `var posted_time`
  `var references`
  `var sender`

  ### Inherited members

  - `Item`:
    - `ID_ELEMENT_CLS`
    - `account`
    - `add_field`
    - `attach`
    - `deregister`
    - `detach`
    - `folder`
    - `register`
    - `remove_field`
    - `supported_fields`
    - `validate_field`
`class PostReplyItem (**kwargs)`

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

  Pick out optional 'account' and 'folder' kwargs, and pass the rest to the parent class.

  :param kwargs: 'account' is optional but allows calling 'send()' and 'delete()' 'folder' is optional but allows calling 'save()'. If 'folder' has an account, and 'account' is not set, we use folder.account.

  Expand source code

      class PostReplyItem(Item):
          """MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/postreplyitem"""

          ELEMENT_NAME = "PostReplyItem"

          # This element only has Item fields up to, and including, 'culture'
          # TDO: Plus all message fields
          new_body = BodyField(field_uri="NewBodyContent")  # Accepts and returns Body or HTMLBody instances

          culture_idx = Item.FIELDS.index_by_name("culture")
          sender_idx = Message.FIELDS.index_by_name("sender")
          FIELDS = Item.FIELDS[: culture_idx + 1] + Message.FIELDS[sender_idx:]

  ### Ancestors

  - Item
  - BaseItem
  - RegisterMixIn
  - IdChangeKeyMixIn
  - EWSElement

  ### Class variables

  `var ELEMENT_NAME`
  `var FIELDS`
  `var culture_idx`
  `var sender_idx`

  ### Instance variables

  `var author`
  `var bcc_recipients`
  `var cc_recipients`
  `var conversation_index`
  `var conversation_topic`
  `var is_delivery_receipt_requested`
  `var is_read`
  `var is_read_receipt_requested`
  `var is_response_requested`
  `var message_id`
  `var new_body`
  `var received_by`
  `var received_representing`
  `var references`
  `var reminder_message_data`
  `var reply_to`
  `var sender`
  `var to_recipients`

  ### Inherited members

  - `Item`:
    - `ID_ELEMENT_CLS`
    - `account`
    - `add_field`
    - `attach`
    - `deregister`
    - `detach`
    - `folder`
    - `register`
    - `remove_field`
    - `supported_fields`
    - `validate_field`