How can I get an email ID?

I need to obtain the unique identification code of each email that is obtained in Outlook. It’s because after processing them, I need to send them to a specific mailbox. I’m going to use an orchestrator, for that reason I need to have the ID of each email in a variable. Can anyone help me here?

1 Like

Hi @Marisa_Ontiveros1
Welcome to the UiPath community!

When iterating over the messages obtained from Outlook (collection of MailMessage items) you can use MailMessage.From which is a String variable containing the email address of the sender.
Similarly, you can also access To, CC, EmailBody properties directly to make things easy for you.

Check out all the properties on MailMessage class docs

we have something called UID* for every mail

For mail message object you can use the UID param as your unique transaction id to record in orchestrator

image

UID - Unique Identification

4 Likes

It has worked. Thanks a lot

1 Like

Pleasure, Let me know any other queries.

Thanks :slight_smile:

Please make sure to check if the mails object returned from ‘Get Outlook Mail Messages’ isn’t empty.
If there are no email messages when the bot runs, the following command will fail:
mails(0).Headers (or any method or parameter that you invoke mails(0).<anyMethod>)

If you run the output mails through a For Each loop it’s easier to avoid such issues.

1 Like

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