Get Outlook Mail - Strange error, gets subject but no other info

I have a workflow which checks an inbox of currently 210 total e-mails. Everything works fine, up until about e-mail #179 in the list. For some reason UiPath is able to return the “Subject” but cannot return “Sender” or “From” details… There isn’t anything obviously unusual about this e-mail when I look at it in Outlook - there is a valid “From” address and the Subject is correct. What is happening here? It’s very weird that the bot works perfectly fine for the other 150+ e-mails and then suddenly has this issue at a certain point.

The below error occurs when trying to assign the “From” or “Sender” of the email.
listMail(emailcounter).Sender.ToString etc…

Screenshot below with censored data.

Update: I have learnt that the FROM address is one of these “Presence Unknown” types in Outlook, as our company uses various alias emails on behalf of another inbox and is one of these.

When I attempted Save Email activity to see what the bot is looking at, I opened this email file and screenshot is below. As you can see, the bot fetches everything else except the FROM is blank/empty. (Note that it is the same sender as the CC here).

How can I handle this so the bot can still check the FROM address of this sender? or what is the best way to manage the error - using a Try Catch?

Appears as in Outlook:
Capture2

What the bot actually sees:
Capture1

Hi @Jon_G,

This error you are getting is usually caused by a variable not being initialised (given a value). Try using an assign to initialise the variable. For example if your variable type is a string, the assign will be MyString = ""

Thanks, I am unable to assign a default value as the variable is a property of the Mail object. (Eg. Mail.Sender.ToString)

The workaround I have created however, is to use a Try Catch block at the beginning of my code. Try to get Sender address then flag “ValidItem = True”. Catches exception and flags “ValidItem=False”

Then in the main chunk of my code, I first have IF ValidItem=True THEN … :slight_smile:

I guess the only problem is that my bot is unable to process any mail items from one of these ‘Presence Unknown’ alias email addresses.

Dear @Jon_G - Above mentioned issue could be your outlook cache related. You can try below steps and verify. Do let us know if didn’t work!

  • In Outlook, select “File” > “Account Settings” > “Account Settings“.
  • Select the Exchange account in the list under the “E-mail” tab, then select “Change…“.
  • Check the “Use Cached Exchange Mode” box to enable it. Uncheck it to disable it.