Skip to content

Commit bff7775

Browse files
author
Alejandro Casanovas
committed
Enhancement googleapis#275
Message: Added new method 'mark_as_unread' to mark the message as unread.
1 parent 01ae49d commit bff7775

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

O365/message.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,28 @@ def mark_as_read(self):
696696

697697
return True
698698

699+
def mark_as_unread(self):
700+
""" Marks this message as unread in the cloud
701+
702+
:return: Success / Failure
703+
:rtype: bool
704+
"""
705+
if self.object_id is None or self.__is_draft:
706+
raise RuntimeError('Attempting to mark as unread an unsaved Message')
707+
708+
data = {self._cc('isRead'): False}
709+
710+
url = self.build_url(
711+
self._endpoints.get('get_message').format(id=self.object_id))
712+
713+
response = self.con.patch(url, data=data)
714+
if not response:
715+
return False
716+
717+
self.__is_read = False
718+
719+
return True
720+
699721
def move(self, folder):
700722
""" Move the message to a given folder
701723

0 commit comments

Comments
 (0)