Mailbox

class O365.mailbox.AutoReplyStatus(*values)[source]

Bases: Enum

Valid values for status.

ALWAYSENABLED = 'alwaysEnabled'
DISABLED = 'disabled'
SCHEDULED = 'scheduled'
class O365.mailbox.AutomaticRepliesSettings(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

The AutomaticRepliesSettingss.

__init__(*, parent=None, con=None, **kwargs)[source]

Representation of the AutomaticRepliesSettings.

Parameters:
  • parent (Mailbox) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

property external_audience: ExternalAudience

External Audience of auto reply.

Getter:

get the external audience of auto reply

Setter:

set the external audience of auto reply

Type:

autoreplystatus

external_reply_message

The automatic reply to send to the specified external audience, if Status is AlwaysEnabled or Scheduled.

   Type: str

internal_reply_message

The automatic reply to send to the audience internal to the signed-in user’s organization, if Status is AlwaysEnabled or Scheduled.

   Type: str

property scheduled_enddatetime

Scheduled End Time of auto reply.

Getter:

get the scheduled_enddatetime time

Setter:

set the reminder time

Type:

datetime

property scheduled_startdatetime

Scheduled Start Time of auto reply.

Getter:

get the scheduled_startdatetime time

Setter:

set the scheduled_startdatetime time

Type:

datetime

property status: AutoReplyStatus

Status of auto reply.

Getter:

get the status of auto reply

Setter:

set the status of auto reply

Type:

autoreplystatus

class O365.mailbox.ExternalAudience(*values)[source]

Bases: Enum

Valid values for externalAudience.

ALL = 'all'
CONTACTSONLY = 'contactsOnly'
NONE = 'none'
class O365.mailbox.Folder(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

A Mail Folder representation.

__init__(*, parent=None, con=None, **kwargs)[source]

Create an instance to represent the specified folder in given parent folder

Parameters:
  • parent (mailbox.Folder or Account) – parent folder/account for this folder

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

  • name (str) – name of the folder to get under the parent (kwargs)

  • folder_id (str) – id of the folder to get under the parent (kwargs)

copy_folder(to_folder)[source]

Copy this folder and it’s contents to into another folder

Parameters:

to_folder (mailbox.Folder or str) – the destination Folder/folder_id to copy into

Returns:

The new folder after copying

Return type:

mailbox.Folder or None

create_child_folder(folder_name)[source]

Creates a new child folder under this folder

Parameters:

folder_name (str) – name of the folder to add

Returns:

newly created folder

Return type:

mailbox.Folder or None

delete()[source]

Deletes this folder

Returns:

Deleted or Not

Return type:

bool

delete_message(message)[source]

Deletes a stored message

Parameters:

message (Message or str) – message/message_id to delete

Returns:

Success / Failure

Return type:

bool

get_folder(*, folder_id=None, folder_name=None)[source]

Get a folder by it’s id or name

Parameters:
  • folder_id (str) – the folder_id to be retrieved. Can be any folder Id (child or not)

  • folder_name (str) – the folder name to be retrieved. Must be a child of this folder.

Returns:

a single folder

Return type:

mailbox.Folder or None

get_folders(limit=None, *, query=None, order_by=None, batch=None)[source]

Return a list of child folders matching the query.

Parameters:
  • limit (int) – max no. of folders to get. Over 999 uses batch.

  • query (Query or str) – applies a filter to the request such as “displayName eq ‘HelloFolder’”

  • order_by (Query or str) – orders the result set based on this condition

  • batch (int) – batch size, retrieves items in batches allowing to retrieve more items than the limit.

Returns:

list of folders

Return type:

list[mailbox.Folder] or Pagination

get_message(object_id=None, query=None, *, download_attachments=False)[source]

Get one message from the query result. A shortcut to get_messages with limit=1

Parameters:
  • object_id – the message id to be retrieved.

  • query (Query or str) – applies a filter to the request such as “displayName eq ‘HelloFolder’”

  • download_attachments (bool) – whether or not to download attachments

Returns:

one Message

Return type:

Message or None

get_messages(limit=25, *, query=None, order_by=None, batch=None, download_attachments=False)[source]

Downloads messages from this folder

Parameters:
  • limit (int) – limits the result set. Over 999 uses batch.

  • query (Query or str) – applies a filter to the request such as “displayName eq ‘HelloFolder’”

  • order_by (Query or str) – orders the result set based on this condition

  • batch (int) – batch size, retrieves items in batches allowing to retrieve more items than the limit.

  • download_attachments (bool) – whether or not to download attachments

Returns:

list of messages

Return type:

list[Message] or Pagination

get_parent_folder()[source]

Get the parent folder from attribute self.parent or getting it from the cloud

Returns:

Parent Folder

Return type:

mailbox.Folder or None

move_folder(to_folder, *, update_parent_if_changed=True)[source]

Move this folder to another folder

Parameters:
  • to_folder (mailbox.Folder or str) – the destination Folder/folder_id to move into

  • update_parent_if_changed (bool) – updates self.parent with the new parent Folder if changed

Returns:

The new folder after copying

Return type:

mailbox.Folder or None

new_message()[source]

Creates a new draft message under this folder

Returns:

new Message

Return type:

Message

refresh_folder(update_parent_if_changed=False)[source]

Re-download folder data Inbox Folder will be unable to download its own data (no folder_id)

Parameters:

update_parent_if_changed (bool) – updates self.parent with new parent Folder if changed

Returns:

Refreshed or Not

Return type:

bool

update_folder_name(name, update_folder_data=True)[source]

Change this folder name

Parameters:
  • name (str) – new name to change to

  • update_folder_data (bool) – whether or not to re-fetch the data

Returns:

Updated or Not

Return type:

bool

child_folders_count

The number of immediate child mailFolders in the current mailFolder.

   Type: int

folder_id

The mailFolder’s unique identifier.

   Type: str

name

The mailFolder’s display name.

   Type: str

parent

The parent of the folder.

   Type: str

parent_id

The unique identifier for the mailFolder’s parent mailFolder.

   Type: str

root

Root folder.

   Type: bool

total_items_count

The number of items in the mailFolder.

   Type: int

unread_items_count

The number of items in the mailFolder marked as unread.

   Type: int

updated_at

Last time data updated

   Type: datetime

class O365.mailbox.MailBox(*, parent=None, con=None, **kwargs)[source]

Bases: Folder

The mailbox folder.

__init__(*, parent=None, con=None, **kwargs)[source]

Create an instance to represent the specified folder in given parent folder

Parameters:
  • parent (mailbox.Folder or Account) – parent folder/account for this folder

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

  • name (str) – name of the folder to get under the parent (kwargs)

  • folder_id (str) – id of the folder to get under the parent (kwargs)

archive_folder()[source]

Shortcut to get Archive Folder instance

Return type:

mailbox.Folder

clutter_folder()[source]
Shortcut to get Clutter Folder instance

The clutter folder low-priority messages are moved to when using the Clutter feature.

Return type:

mailbox.Folder

conflicts_folder()[source]
Shortcut to get Conflicts Folder instance

The folder that contains conflicting items in the mailbox.

Return type:

mailbox.Folder

conversationhistory_folder()[source]
Shortcut to get Conversation History Folder instance

The folder where Skype saves IM conversations (if Skype is configured to do so).

Return type:

mailbox.Folder

deleted_folder()[source]

Shortcut to get DeletedItems Folder instance

Return type:

mailbox.Folder

drafts_folder()[source]

Shortcut to get Drafts Folder instance

Return type:

mailbox.Folder

get_settings()[source]

Return the MailboxSettings.

Return type:

mailboxsettings

inbox_folder()[source]

Shortcut to get Inbox Folder instance

Return type:

mailbox.Folder

junk_folder()[source]

Shortcut to get Junk Folder instance

Return type:

mailbox.Folder

localfailures_folder()[source]

Shortcut to get Local Failure Folder instance The folder that contains items that exist on the local client but could not be uploaded to the server.

Return type:

mailbox.Folder

outbox_folder()[source]

Shortcut to get Outbox Folder instance

Return type:

mailbox.Folder

recoverableitemsdeletions_folder()[source]

Shortcut to get Recoverable Items Deletions (Purges) Folder instance The folder that contains soft-deleted items: deleted either from the Deleted Items folder, or by pressing shift+delete in Outlook. This folder is not visible in any Outlook email client, but end users can interact with it through the Recover Deleted Items from Server feature in Outlook or Outlook on the web.

Return type:

mailbox.Folder

scheduled_folder()[source]

Shortcut to get Scheduled Folder instance The folder that contains messages that are scheduled to reappear in the inbox using the Schedule feature in Outlook for iOS.

Return type:

mailbox.Folder

searchfolders_folder()[source]

Shortcut to get Search Folders Folder instance The parent folder for all search folders defined in the user’s mailbox.

Return type:

mailbox.Folder

sent_folder()[source]

Shortcut to get SentItems Folder instance

Return type:

mailbox.Folder

serverfailures_folder()[source]

Shortcut to get Server Failures Folder instance The folder that contains items that exist on the server but could not be synchronized to the local client.

Return type:

mailbox.Folder

set_automatic_reply(internal_text: str, external_text: str, scheduled_start_date_time: datetime = None, scheduled_end_date_time: datetime = None, externalAudience: ExternalAudience = ExternalAudience.ALL)[source]

Set an automatic reply for the mailbox.

Returns:

Success / Failure

Return type:

bool

set_disable_reply()[source]

Disable the automatic reply for the mailbox.

Returns:

Success / Failure

Return type:

bool

syncissues_folder()[source]

Shortcut to get Sync Issues Folder instance The folder that contains synchronization logs created by Outlook.

Return type:

mailbox.Folder

class O365.mailbox.MailboxSettings(*, parent=None, con=None, **kwargs)[source]

Bases: ApiComponent

The MailboxSettings.

__init__(*, parent=None, con=None, **kwargs)[source]

Representation of the MailboxSettings.

Parameters:
  • parent (Mailbox) – parent object

  • con (Connection) – connection to use if no parent specified

  • protocol (Protocol) – protocol to use if no parent specified (kwargs)

  • main_resource (str) – use this resource instead of parent resource (kwargs)

save()[source]

Save the MailboxSettings.

Returns:

Success / Failure

Return type:

bool

automaticrepliessettings

Configuration settings to automatically notify the sender of an incoming email with a message from the signed-in user.

   Type: AutomaticRepliesSettings

timezone

The default time zone for the user’s mailbox.

   Type: str

workinghours

The days of the week and hours in a specific time zone that the user works.

   Type: workingHours