In UiPath Studio development, there are cases where we want to manipulate Outlook emails in Office365.
This article describes how to manipulate Outlook email in Office365 using Microsoft Office365 Activities.
\Save during the sale period!/
Take a look at the UiPath course on the online learning service Udemy
*Free video available
Related Articles Learn the Creation Techniques f UiPath robotics creation with Udemy’s online courses that take it up a notch
This site was created by translating a blog created in Japanese into English using the DeepL translation.
Please forgive me if some of the English text is a little strange
How to Prepare and Use Office365 Activities
How to Install Office365 Activities
Microsoft Office365 Activities are not present in the process created by default.
A separate MicrosoftOffice365.Activities activity package must be added.
For instructions on how to install Microsoft Office365 Activities, please refer to the Installing the Office365 Activities Package article.
How to use Office365 Activities
Each Office365 activity is used by placing the activity within the “Microsoft Office 365 Scope” or “Use OneDrive and SharePoint”.
The “Microsoft Office 365 Scope” is recommended since all activities under the “Integration>Microsoft>Office365” can be used.
However, “App Registration” must be configured for AzureAD.
“Use OneDrive and SharePoint” only uses activities under the “Integration>Microsoft>Office365>Files” and can only manipulate files on Office365.
List of file manipulation activities in Office365
Activities that manipulate Office365 files can be found under “Integration>Microsoft>Office365>Outlook”.
The following table shows the activities under “Integration>Microsoft>Office365>Outlook”.
Activity Location | Activity Name | What you can do in Activities |
Integrations> Microsoft> Office365> Outlook |
Reply to Mail | Uses the Microsoft Graph Create Reply and Reply APIs to reply to an email message. |
Set Mail Categories | Uses the Microsoft Graph Update message API to associate categories with a message. | |
Delete Mail | Uses the Microsoft Graph Delete message API to delete an email message. | |
Get Mail | Uses the Microsoft Graph Get message and List messages APIs to retrieve the matching messages from a specified mailbox (Mailbox). | |
Move Mail | Uses the Microsoft Graph Move event message API to move a message (Message) to a different mail folder (DestinationFolder). | |
Forward Mail | Uses the Microsoft Graph Create forward and Forward event message API to forward a message (Message), with additional content (Body), to one or more recipients (To). | |
Send Mail | Uses the Microsoft Graph Create message and Send mail APIs to send a message (Body and Subject) to one or more recipients (To, CC, and BCC). |
Outlook email operations in Office365
To manipulate Outlook email in Office365, use the activity found under “Integration>Microsoft>Office365>Outlook”.
Get Mail
To manipulate the mail in Outlook, first retrieve the “Office365Message” array by searching for it in the “Get Mail” activity.
The retrieved Office365Message can then be used in other activities to forward, move, etc.
Get Mail
Setting Location | Setting item | Setting details | |
Properties | Common | DisplayName | The display name of the activity. |
Input | Account | (Optional) The email address with which to interact. | |
Mail Folder | The mail folder from which the messages are retrieved. | ||
Misc | Private | If selected, the values of variables and arguments are no longer logged at Verbose level. | |
Options | Get As HTML | If selected, the message body is returned in HTML format. | |
Mark As Read | If selected, the returned messages are marked as read. | ||
Only Unread Messages | If selected, only unread messages are returned. The default value is True. | ||
Order By Date | The returned messages are ordered by date. The available options are NewestFirst and OldestFirst. | ||
Query | Query used for filtering the returned emails. | ||
Top | The maximum number of emails to retrieve. | ||
Output | Result | Returns all emails from the user’s inbox. |
A user logged into Office365 at the time of workflow execution, retrieves three messages in the Outlook inbox and displays the message subject in the log message.
・variable
・Properties of “Microsoft Office 365 Scope”
・Properties of “Get Mail”
・Target inbox to retrieve email from
・Log of workflow execution results
Send Mail
Use the “Send Mail” activity to send an email in Outlook.
Send Mail setting items
Setting Location | Setting item | Setting details | |
Properties | Attachments | Attachments | A collection containing the paths to the files attached to the email. |
Attachments Collection | An additional list of files attached to the message. | ||
Common | DisplayName | The display name of the activity. | |
Body | The email’s message body. | ||
Subject | The subject of the email. | ||
Input | Account | (Optional) The email address with which to interact. | |
Misc | Private | If selected, the values of variables and arguments are no longer logged at Verbose level. | |
Options | From | The email address from which the email is sent. | |
Importance | The importance of the mail message. | ||
Is Body HTML | If selected, the body of the email is interpreted in HTML format. | ||
Is Draft | If selected, the message is saved as a draft and not sent. | ||
Reply to | The email addresses to use when replying. | ||
Recipients | Bcc | A comma-separated list of email addresses that you want to be included as Bcc recipients. | |
Cc | A comma-separated list of email addresses that you want to be included as Cc recipients. | ||
To | A comma-separated list of email addresses that you want to send your mail to. |
Send email with Outlook in Office365.
・Variable
・Properties of “Microsoft Office 365 Scope”
・Properties of “Send Mail”
・Send items after workflow execution
Forward Mail
To forward an email in Outlook, first search for it in the “Get Mail” activity and get it as an array of type “Office365Message”.
Next, the acquired Office365Message is used in “Forward Mail” to forward the mail.
Forward Mail setting items
Setting Location | Setting item | Setting details | |
Properties | Attachments | Attachments | A collection containing the paths to the files to be attached to the email. |
Attachments Collection | An additional list of files to be attached to the email. | ||
Replace Existing | Indicates whether to replace the existing attachments with the same name. | ||
Common | DisplayName | The display name of the activity. | |
Input | Account | (Optional) The email address with which to interact. | |
Body | The email’s message body. | ||
Message | The email to forward. This field supports only Office365Message variables. | ||
New Subject | The new subject of the email. | ||
Misc | Private | If selected, the values of variables and arguments are no longer logged at Verbose level. | |
Options | Is Draft | If selected, the message is saved as a draft and not sent. | |
Recipients | Bcc | A list of additional email addresses that you want to add as Bcc recipients. | |
Cc | A list of additional email addresses that you want to add as Cc recipients. | ||
To | A comma-separated list of email addresses that you want to send your mail forward to. |
When executing a workflow, a user logged into Office365 can retrieve up to five messages in the Outlook Inbox with the subject line “Email Notification” and forward the email to another user.
・Variable
・Properties of “Microsoft Office 365 Scope”
・Properties of “Get Mail”
・Properties of “For Each”
・Properties of “Forward Mail”
・Inbox for mail retrieval
・Sent items after workflow execution
Move Mail
To move an email in Outlook, first search for it in the “Get Mail” activity and get it as an array of type “Office365Message”.
Next, the retrieved Office365Message is used in “Move Mail” to move the mail.
Move Mail setting items
設定場所 | 設定項目 | 設定内容 | |
Properties | Common | DisplayName | The display name of the activity. |
Input | Account | (Optional) The email address with which to interact. | |
DestinationFolder | The destination folder’s name. | ||
Message | The message to move. | ||
Misc | Private | If selected, the values of variables and arguments are no longer logged at Verbose level. |
A user logged into Office365 at the time of workflow execution, retrieves one message with the sender “fpenuser02@*******.onmicrosoft.com” in the Outlook Inbox and moves the email to the “Archive” folder.
・variable
・Properties of “Microsoft Office 365 Scope”
・Properties of “Get Mail”
・Properties of “For Each”
・Properties of “Move Mail”
・Inbox before process execution
・Archive before process execution
・Archive after process execution
Delete Mail
To delete an email in Outlook, first search for it with the “Get Mail” activity and get it as an array of “Office365Message”.
Next, use “Delete Mail” with the obtained Office365Message to delete the mail.
Delete Mail setting items
設定場所 | 設定項目 | 設定内容 | |
Properties | Common | DisplayName | The display name of the activity. |
Input | Account | (Optional) The email address with which to interact. | |
Message | The message to delete. | ||
PermanentlyDelete | Indicates whether to delete the email permanently. | ||
Misc | Private | If selected, the values of variables and arguments are no longer logged at Verbose level. |
Delete the oldest message in the Outlook Inbox for the user logged into Office365 at the time of workflow execution.
・Variable
・Properties of “Microsoft Office 365 Scope”
・Properties of “Get Mail”
・Properties of “For Each”
・Properties of “Delete Mail”
・Inbox before workflow execution
・Inbox after workflow execution
・Delete tray after workflow execution
summary
- To manipulate Outlook email in Office365, first add the MicrosoftOffice365.Activities activity package.
- Microsoft Office 365 Scope” to the workflow that manipulates Office365 email and place the “Integration>Microsoft>Office365>Outlook” activity within it.
- The “Get Mail” activity searches the mail box and retrieves the results as an “Office365Message” type, which can then be used in other activities to manipulate the mail.
\Save during the sale period!/
Take a look at the UiPath course on the online learning service Udemy
*Free video available
Related Articles Learn the Creation Techniques f UiPath robotics creation with Udemy’s online courses that take it up a notch
same category UiPath

Japanese IT engineer with a wide range of experience in system development, cloud building, and service planning. In this blog, I will share my know-how on UiPath and certification. profile detail / twitter:@fpen17