How to read unread mails in outlook using uipath

To read unread emails in Outlook using UiPath, you can follow these steps:

Prerequisites:

  1. You have UiPath Studio installed on your machine.
  2. You have an Outlook account set up on your machine.
  3. You have the Outlook activity installed in your UiPath project.

Step 1: Create a new UiPath project

Open UiPath Studio and create a new project.

Step 2: Add the Outlook activity

In the Project panel, right-click and select "Add Activity" > "Outlook" > "Get Items from Folder".

Step 3: Configure the Get Items from Folder activity

In the "Get Items from Folder" activity, configure the following settings:

Step 4: Add a Loop activity

Add a Loop activity to iterate through the retrieved emails.

Step 5: Add an Read Email activity

Inside the Loop activity, add an "Read Email" activity to read the contents of each email.

Step 6: Configure the Read Email activity

In the "Read Email" activity, configure the following settings:

Step 7: Run the workflow

Run the workflow to execute the activities.

Here's the sample code:

<Activities>
  <GetItemsFromFolder x:TypeArguments="x:MailFolder" x:Name="GetUnreadEmails">
    <Folder>x:Inbox</Folder>
    <SearchCriteria>Unread</SearchCriteria>
    <SearchScope>CurrentFolder</SearchScope>
  </GetItemsFromFolder>
  <Loop x:TypeArguments="x:MailItem" x:Name="LoopUnreadEmails">
    <Items>
      <GetItemsFromFolder.Item />
    </Items>
    <Body>
      <ReadEmail x:TypeArguments="x:MailItem" x:Name="ReadEmail">
        <Email><LoopUnreadEmails.Item /></Email>
        <Read>true</Read>
      </ReadEmail>
    </Body>
  </Loop>
</Activities>

This code retrieves unread emails from the Inbox folder, loops through each email, and marks each email as read.

Note: Make sure to adjust the code according to your specific requirements and Outlook configuration.