Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Now get_message allows to specify an object_id and expands or selects as well.
  • Loading branch information
Alejandro Casanovas committed Sep 12, 2019
1 parent f28c75a commit dd6f33b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion O365/mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ def get_message(self, object_id=None, query=None, *, download_attachments=False)

if object_id is not None:
url = self.build_url(self._endpoints.get('message').format(id=object_id))
response = self.con.get(url)
params = None
if query and query.has_selects or query.has_expands:
params = query.as_params()
response = self.con.get(url, params=params)
if not response:
return None

Expand Down
2 changes: 1 addition & 1 deletion O365/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def __init__(self, *, parent=None, con=None, **kwargs):
'HTML') # default to HTML for new messages
if self.has_attachments is False and self.body_type.upper() == 'HTML':
# test for inline attachments (Azure responds with hasAttachments=False when there are only inline attachments):
if any( img.get('src','').startswith('cid:') for img in self.get_body_soup().find_all('img')):
if any(img.get('src', '').startswith('cid:') for img in self.get_body_soup().find_all('img')):
self.has_attachments = True

if self.has_attachments and download_attachments:
Expand Down

0 comments on commit dd6f33b

Please sign in to comment.