How to read subject from outlook mail in uipath
To read the subject of an Outlook email using UiPath, you can follow these steps:
Method 1: Using the Get Email
activity
- Add a
Get Email
activity to your workflow. - Configure the activity to connect to your Outlook account.
- In the
Get Email
activity, set theSearch Criteria
toUnread
orAll
depending on your requirement. - In the
Get Email
activity, set theFolder
to the folder where you want to read the email from (e.g., Inbox, Sent Items, etc.). - Add a
Get Property
activity inside theGet Email
activity. - Set the
Property
toSubject
. - Run the workflow.
The Get Property
activity will return the subject of the email as a string.
Method 2: Using the Get Email Message
activity
- Add a
Get Email Message
activity to your workflow. - Configure the activity to connect to your Outlook account.
- In the
Get Email Message
activity, set theEmail Message
property to the email you want to read. - Add a
Get Property
activity inside theGet Email Message
activity. - Set the
Property
toSubject
. - Run the workflow.
The Get Property
activity will return the subject of the email as a string.
Example Code
Here's an example code snippet that demonstrates how to read the subject of an Outlook email using the Get Email
activity:
<Activities>
<Get Email>
<SearchCriteria>Unread</SearchCriteria>
<Folder>Inbox</Folder>
<Get Property>
<Property>Subject</Property>
</Get Property>
</Get Email>
</Activities>
And here's an example code snippet that demonstrates how to read the subject of an Outlook email using the Get Email Message
activity:
<Activities>
<Get Email Message>
<Email Message> outlook://Inbox/1234567890</Email Message>
<Get Property>
<Property>Subject</Property>
</Get Property>
</Get Email Message>
</Activities>
Note: Make sure to replace outlook://Inbox/1234567890
with the actual email message ID or path to the email you want to read.