Ir para o conteúdo

botcity.plugins.ms365.outlook.plugin.MS365OutlookPlugin

mail_folder: Folder property writable

The email folder that will be used as a reference in operations.

By default, the 'inbox' folder will be used.

outlook_service: MailBox property readonly

The Office365/Microsoft365 account service.

You can use this property to access Outlook functionality.

__init__(self, service_account) special

MS365OutlookPlugin.

Parameters:

Name Type Description Default
service_account MS365CredentialsPlugin

The authenticated Microsoft365 account. The authentication process must be done through the credentials plugin.

required

copy(self, msg, folder_name)

Copy a email message to a destination folder.

Parameters:

Name Type Description Default
msg Message

The message to be copied.

required
folder_name str

The name of the destination folder.

required

create_folder(self, folder_name, parent_folder=None)

Create a new email folder.

Parameters:

Name Type Description Default
folder_name str

The name of the folder to be created.

required
parent_folder Folder

Create a child folder under this parent folder.

None

Returns:

Type Description
Folder

The reference of the new folder that was created.

delete(self, msg)

Delete a email message.

Parameters:

Name Type Description Default
msg Message

The message to be deleted.

required

delete_folder(self, folder_name, parent_folder=None)

Delete a email folder.

Parameters:

Name Type Description Default
folder_name str

The name of the folder to be deleted.

required
parent_folder Folder

Delete a child folder from this parent folder.

None

download_attachments(self, msg, download_folder_path='')

Download attachments from a given email message.

Parameters:

Name Type Description Default
msg Message

The message that contains the attachments.

required
download_folder_path str

The path of the folder where the files will be saved.

''

forward(self, msg, to_addrs, cc_addrs=[], bcc_addrs=[], text_content='')

Forward a received email message.

Parameters:

Name Type Description Default
msg Message

The message to forward.

required
to_addrs List[str]

The list of email addresses that will receive the message.

required
cc_addrs List[str]

The list of email addresses that will receive the message as CC.

[]
bcc_addrs List[str]

The list of email addresses that will receive the message as BCC.

[]
text_content str

The additional content of the email body.

''

get_folder(self, folder_name, parent_folder=None)

Get email folder by name.

Parameters:

Name Type Description Default
folder_name str

The name of the folder to be searched.

required
parent_folder Folder

Get a child folder from this parent folder.

None

Returns:

Type Description
Folder

The folder object.

get_folders(self, parent_folder=None)

Get a list of available email folders.

Parameters:

Name Type Description Default
parent_folder Folder

Get child folders from this parent folder.

None

Returns:

Type Description
List[Folder]

The list containing the object of each found folder.

mark_as_read(self, msg)

Mark a received email message as read.

Parameters:

Name Type Description Default
msg Message

The message to be marked.

required

mark_as_unread(self, msg)

Mark a received email message as unread.

Parameters:

Name Type Description Default
msg Message

The message to be marked.

required

move(self, msg, folder_name)

Move a email message to a destination folder.

Parameters:

Name Type Description Default
msg Message

The message to be moved.

required
folder_name str

The name of the destination folder.

required

new_query_filter(self)

Return a Query object that can be used to create a search filter.

Returns:

Type Description
Query

The Query object to build the query filter.

reply(self, msg, text_content, attachments=[], to_addrs=[], cc_addrs=[], bcc_addrs=[])

Reply a received email message.

Parameters:

Name Type Description Default
msg Message

The message to reply.

required
text_content str

The content of the email body.

required
attachments List[str]

The list with the paths of the files that will be sent as attachments.

[]
to_addrs List[str]

The list of email addresses that will receive the message.

[]
cc_addrs List[str]

The list of email addresses that will receive the message as CC.

[]
bcc_addrs List[str]

The list of email addresses that will receive the message as BCC.

[]

reply_to_all(self, msg, text_content, attachments=[])

Reply to all email addresses included in the original message.

Parameters:

Name Type Description Default
msg Message

The message to reply.

required
text_content str

The content of the email body.

required
attachments List[str]

The list with the paths of the files that will be sent as attachments.

[]

search_messages(self, criteria=None, include_attachments=False, mark_read=False, limit=25, timeout=0)

Search for all emails messages based on criteria.

Parameters:

Name Type Description Default
criteria Query | str

The criteria that will be used as a message filter.

None
include_attachments bool

Whether or not to include the attachments in the message object.

False
mark_read bool

Whether the email should be marked as read. Defaults to False.

False
limit int

Limits the result set.

25
timeout int

Wait for a new message until this timeout. Defaults to 0 seconds (don't wait for new messages).

0

Returns:

Type Description
List[Message]

The list of emails found.

send_message(self, subject, text_content, to_addrs, cc_addrs=[], bcc_addrs=[], attachments=[])

Send a new email message.

Parameters:

Name Type Description Default
subject str

The subject of the email.

required
text_content str

The content of the email body.

required
to_addrs List[str]

The list of email addresses that will receive the message.

required
cc_addrs List[str]

The list of email addresses that will receive the message as CC.

[]
bcc_addrs List[str]

The list of email addresses that will receive the message as BCC.

[]
attachments List[str]

The list with the paths of the files that will be sent as attachments.

[]

set_default_folder(self, folder)

Set a specific folder as the default folder.

Parameters:

Name Type Description Default
folder Folder | str

The name or Folder object of the folder that will be used in operations.

required