Read from an email and copy or filter something specific

Hello, this is my first post.

Can someone maybe help me how I can read every email in a specific folder in Outlook. In order to then copy something specific and paste it somewhere else.
For example, somewhere in the email there is always the number: xxxx and I only need the xxxx.

(repeat until there are no more emails there, it’s best to process one email first and then the next ones as there will be a process in between)

So how can I read the emails and only take the xxxx from them?

Thank you in advance.

@Energy

Follow this workflow steps:

Get Outlook Mail Messages:
Configure the activity to connect to your Outlook account and select the folder.

For Each (email in retrievedEmails):
a. Get Email Properties:
- Use the “Get IMAP Email Properties” or “Get POP3 Email Properties” activity to access email properties.

b. Extract the “xxxx” value:
- Use string manipulation techniques to extract the specific information.

c. Store the extracted data in a variable.

d. Perform further processing (e.g., write data to a spreadsheet or perform calculations).

The loop will repeat for each email in the folder.

1 Like

Thanks for the quick reply.

Since I don’t really understand this, could I perhaps see this in practice?

And how can I extract the value “xxxx” if it would change every time. The only constant will be that it will be preceded by “Number:”?

So how do I do points b) and c) exactly?

Best regards

Yes, we can extract can i get the Sample input so I can provide you the regex Code

Hello,

This is what it could look like in the email.

I always need something that comes after “Number1:” here. But it could be somewhere different every time and the numbers afterwards could be different.

Shouldn’t I have to read the email first?

Greetings and thank you

You need to extract Number 1 use this REGEX patren: (?<=Number1:\s)+\d+
You need to extract Number 2 use this REGEX patren: (?<=Number2:\s)+\d+

image

Let me know if you have any doubt

1 Like

Thanks, it’s going in the right direction.

I wanted to output this with MessageBox, previously I used GetText.

How would I have to write the “(?<=Number1:\s)+\d+” in MessageBox so that I can output “1234567”. I’m sorry that I don’t understand all of this straight away.

Hi @Energy
use this expression
System.Text.RegularExpressions.Regex.Match(input_string,“(?<=Number1:\s)+\d+”).Value.Trim

if you need it in message box

Regards,
Gayathri M K

1 Like

Hi, how can I save what is output in the message box as a variable and, for example, insert it somewhere else?
Unfortunately, simply saving it in Assign and having it output didn’t work.

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