Uipath sutdio Outlook automation

I need help if you can guide me. Actually, I want to specific lines of my outlook mail in word or notepad. I have worked on how to save mail but it saves complete mail. I am looking forward if you can provide me some solution. Thanks and Best Regards

Hi,
Do you mean you want to get body/content of email ?

@mtalha.shafiq Don’t save the email read email using get outlook mail message and then loop through list of mail message and then mailItem.body will give you the data…
then use string manipulation to get what you want

  • Order No.: E00068954
    like the above line in this number will be changed but the pattern will remain the same one thing is that I want to copy

Reason: Payment failed, result: {“fullResponse”:{“additionalData”:{“refusalReasonRaw”:“721 : Declined - Transaction risk (401)”},"
2nd thing is that above line which I want to save from the mail

@mtalha.shafiq

  • After you use ‘Get Outlook Mail Messages’ activity then you will get List of MailMessage.
  • Add ‘For Each’ activity to loop through each MailMessage(item)
  • Inside For Each, use ‘Assign’ activity to get whole email body
    String MailBody = item.Body
  • Then you need to extract wording from your patterns
    1. Extract Order No.
      Use ‘Assign’ activity (Assume that your order no.'s length is 9)
      String OrderNumber = System.Text.RegularExpressions.Regex.Match(MailBody.ToString,"(?<=Order\sNo.:\s)\w{9}").ToString.Trim
    1. Extract Result
      Use ‘Assign’ activity (Assume to extract wording after ‘Reason:’ text)
      String ResultMessage = System.Text.RegularExpressions.Regex.Match(MailBody.ToString,"(?<=Reason:\s).*").ToString.Trim

@tavineei
Thanks for your guides. thing is that I am new to uipath and I am using Uipath StudioX and most of the things available on the Internet are only for Studio. I have followed your step but it’s not working I know I didn’t follow correctly. I am attaching pics of my work If you can see and let me know how can I do it properly it would be a great help.

Hi,
Please see attached file for the correct statement.
(Email setting is depend on your requirement)
Main.zip (2.0 KB)
image