Get Outlook Mail Messages : About Filters, Top, SenderEmailAddress, MailMessage, MutlipleAccount

******************* Get Outlook Mail Messages *******************

Get Outlook Mail Messages Activity :
Retrieve the emails from your outlook mailbox.

Package : UiPath.Mail.Outlook

Properties :

1. Account:

  • Enter the Outlook Email Id.
  • You can also Leave it Empty.
    In this case, it consider the default email id of Outlook Mailbox.
  • Remember : At a time it can read only one email id of Outlook Mailbox.

Multiple Outlook Email Account Available in the Outlook
If you wish to access multiple email ids that are configured in the outlook mailbox, then you can loop through it

  • Create an Array of String that has all the Email Ids.
  • Take a For each of ArrayEmailAccIds.
  • In the For each:
    -Assign variable CurrentEmailAccount = item.
    -Add the Get Outlook Mail Message Activity.
    -Add Account = CurrentEmailAccount.
    -Now, you can have access to one email account at a time.
    -Next Iteration, It will pick another email id from the ArrayEmailAccIds.
    -End of For Each.

2. Filter

  • Filter your List of Emails in MailBox based on Subject Name, SendEmailId, Etc
  • Filter = “[SenderEmailAddress] = ‘’”
  • Filter = “[Subject] = 'Product Information '”
  • Filter = "[ReceivedTime]= ‘07/31/2021’ "

3. Top

  • Returns the number of emails.
  • Enter the No of emails you want to retrieve.
  • By Default, the value appears to be 30.
  • If Left empty it returns 0 Emails.
  • If you wish to read all the emails available you can either pass -1 or Int32.MaxValue.

4. Messages

  • Returns a List of the emails.
    Name the output variable as ListOfEmails
  • Type of ListOfEmails : System.Collections.Generic.List<System.Net.Mail.MailMessage>
  • For each of ListOfEmails.
    Set the TypeArgument : System.Net.Mail.MailMessage

Extract Information from Email

1. Extract the Sender Name from the Email

  • For Each item in ListOfEmails
    Assign → sender = item.From.ToString
    Assign → sender = message.Sender.ToString

2. Check if there is any attachments in the current email

  • For Each item in ListOfEmails
    If → item.Attachments.Any

Feel free to let me know more about the UiPath Activity Get Outlook Mail Messages.
Also, Please correct me, if you find something needs to be changed or corrected.

Geet M