MCPcopy Create free account
hub / github.com/O365/python-o365 / set_automatic_reply

Method set_automatic_reply

O365/mailbox.py:793–818  ·  view source on GitHub ↗

Set an automatic reply for the mailbox. :return: Success / Failure :rtype: bool

(
        self,
        internal_text: str,
        external_text: str,
        scheduled_start_date_time: dt.datetime = None,
        scheduled_end_date_time: dt.datetime = None,
        externalAudience: ExternalAudience = ExternalAudience.ALL,
    )

Source from the content-addressed store, hash-verified

791 self._endpoints["settings"] = "/mailboxSettings"
792
793 def set_automatic_reply(
794 self,
795 internal_text: str,
796 external_text: str,
797 scheduled_start_date_time: dt.datetime = None,
798 scheduled_end_date_time: dt.datetime = None,
799 externalAudience: ExternalAudience = ExternalAudience.ALL,
800 ):
801 """Set an automatic reply for the mailbox.
802
803 :return: Success / Failure
804 :rtype: bool
805 """
806 mailboxsettings = self.get_settings()
807 ars = mailboxsettings.automaticrepliessettings
808
809 ars.external_audience = externalAudience
810 ars.status = AutoReplyStatus.ALWAYSENABLED
811 if scheduled_start_date_time or scheduled_end_date_time:
812 ars.status = AutoReplyStatus.SCHEDULED
813 ars.scheduled_startdatetime = scheduled_start_date_time
814 ars.scheduled_enddatetime = scheduled_end_date_time
815 ars.internal_reply_message = internal_text
816 ars.external_reply_message = external_text
817
818 return mailboxsettings.save()
819
820 def _validate_datetime(self, value, erroritem):
821 if not isinstance(value, dt.date):

Callers 1

Calls 2

get_settingsMethod · 0.95
saveMethod · 0.45

Tested by

no test coverage detected