REFramework Validation Error with Microsoft365.MailMessage – Regex Not Working

Hi UiPath Community,

I’m currently working on a project using the REFramework, and I’m integrating Microsoft365 Mail Activities to read emails. However, I’m facing a persistent issue when trying to extract values using Regex in a Multi Assign activity.


:warning: The Expression:

vb

CopyEdit

Regex.Match(in_TransactionItem.Body.ToString, "(?<=Loan Amount Requested:\s*)\d+").Value

or even:

vb

CopyEdit

Regex.Match(in_TransactionItem.Body.Content.ToString, "(?<=Loan Amount Requested:\s*)\d+").Value

:puzzle_piece: The Issue:

  • I get a Validation Error:

vbnet

CopyEdit

BC30652: Reference required to assembly 'System.Net.Mail, Version=6.0.0.0...'
  • It seems REFramework is expecting System.Net.Mail.MailMessage, but my in_TransactionItem is of type Microsoft365.MailMessage (CoPilotMessage).
  • Because of this type mismatch, even though the Regex expression is syntactically correct, the project throws validation errors and doesn’t run.

:white_check_mark: What I’ve Tried:

  • Converting the expression using .Body.ToString, .Body.Content, etc.
  • Ensuring Regex pattern is correct.
  • Checked that in_TransactionItem is being passed properly.

:red_question_mark: What I Need Help With:

  • How can I use Microsoft365.MailMessage within REFramework without triggering validation errors?
  • Do I need to change the argument types in Process.xaml and Main.xaml from System.Net.Mail.MailMessage to Microsoft365.MailMessage?
  • Or is there a way to cast or convert the Microsoft365 message into a format compatible with REFramework’s default structure?

I’m seriously stuck at this point, and I’ve already gone through trial and error multiple times. I’d appreciate a clear and tested solution.

This is the step you will have to take. Change the TransactionItem datatype to Microsoft365.MailMessage and you should be good.

Hi my in_transaction argument is UiPath.MicrosoftOffice365.Models.Office365Message still i encounter Error ERROR Validation Error BC30652: Reference required to assembly ‘System.Net.Mail, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ containing the type ‘MailMessage’. Add one to your project. Framework/Process.xaml
Regex.Match(in_TransactionItem.Body.ToString, “(?<=Loan Amount Requested:\s*)\d+”).Value

@Joshua2,

You will have to import the namespace in your Process.xaml.

Open the Imports panel on your workflow and add the namespace like this:

I have imported System.Net.Mail and System.text.Regular expression
still the issue persists

@Joshua2,

Try reopening the project once. Also try upgrading all the dependencies to latest possible version.

I’m new to UiPath — I installed it just this past Friday — so I’m still getting familiar with the platform. I’ve reopened my project and carefully reviewed the changes, but unfortunately, the issue still persists despite the updates.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.