예제 #1
0
 def _register_property_extensions():
     # Pre-register extended properties that are not standard part of EWS/ExchangeLib
     for prop in all_extended_properties:
         Message.register(**prop)
예제 #2
0
from .core import Source, Handle, FileResource

BaseProtocol.SESSION_POOLSIZE = 1

# An "entry ID" is the special identifier used to open something in the Outlook
# rich client (after converting it to a hexadecimal string). This property can
# be retrieved over the EWS protocol, but exchangelib doesn't do so by default;
# make sure that it does by explicitly registering the property details


class EntryID(ExtendedProperty):
    property_tag = 4095
    property_type = 'Binary'


Message.register("entry_id", EntryID)

OFFICE_365_ENDPOINT = "https://outlook.office365.com/EWS/Exchange.asmx"
# XXX: actually use Microsoft Graph to do this properly (deeplink URLs are
# available through an email's "webLink" property)
_OFFICE_365_DEEPLINK = ("https://outlook.office365.com/owa/?ItemID={0}"
                        "&exvsurl=1&viewmodel=ReadMessageItem")


def _make_o365_deeplink(outlook_message_id):
    return _OFFICE_365_DEEPLINK.format(quote(outlook_message_id, safe=''))


def _dictify_headers(headers):
    if headers:
        d = InsensitiveDict()