Skip to content

Commit f52dd28

Browse files
author
Alejandro Casanovas
committed
Feature Request UniqueBody googleapis#325
1 parent e6f4ba4 commit f52dd28

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

O365/message.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,15 @@ def __init__(self, *, parent=None, con=None, **kwargs):
268268
self.__attachments = MessageAttachments(parent=self, attachments=[])
269269
self.has_attachments = cloud_data.get(cc('hasAttachments'), False)
270270
self.__subject = cloud_data.get(cc('subject'), '')
271-
body = cloud_data.get(cc('body'), {})
272271
self.__body_preview = cloud_data.get(cc('bodyPreview'), '')
272+
body = cloud_data.get(cc('body'), {})
273273
self.__body = body.get(cc('content'), '')
274-
self.body_type = body.get(cc('contentType'),
275-
'HTML') # default to HTML for new messages
274+
self.body_type = body.get(cc('contentType'), 'HTML') # default to HTML for new messages
275+
276+
unique_body = cloud_data.get(cc('uniqueBody'), {})
277+
self.__unique_body = unique_body.get(cc('content'), '')
278+
self.unique_body_type = unique_body.get(cc('contentType'), 'HTML') # default to HTML for new messages
279+
276280
if self.has_attachments is False and self.body_type.upper() == 'HTML':
277281
# test for inline attachments (Azure responds with hasAttachments=False when there are only inline attachments):
278282
if any(img.get('src', '').startswith('cid:') for img in self.get_body_soup().find_all('img')):
@@ -394,6 +398,14 @@ def body(self, value):
394398
self.__body = value
395399
self._track_changes.add('body')
396400

401+
@property
402+
def unique_body(self):
403+
""" The unique body of this message
404+
Requires a select to retrieve it.
405+
:rtype: str
406+
"""
407+
return self.__unique_body
408+
397409
@property
398410
def created(self):
399411
""" Created time of the message """

0 commit comments

Comments
 (0)